Questions about shell scripts, executable files that are interpreted by a shell (bash, zsh, etc.).

learn more… | top users | synonyms (2)

0
votes
2answers
25 views

browser script (automation)

I want to make Mozilla to run as soon as my pc is on. when Mozilla is open it must be redirected to my internet service provider site and must click on a specific field in that site to enable my login....
2
votes
3answers
231 views

Append data of multiple files to new file separated by a line

I have more than a hundred firewall rules for many different customers in discrete files in a folder. Suppose the filenames are: 1.wawa.com_firewall_rule 2.newa.com_firewall_rule Each file ...
2
votes
1answer
308 views

Why is my inotifywait loop exiting after removing some subdirectories?

i have the following bash script: #!/bin/sh dir1=/source/dir/path/ while inotifywait -qqre modify "$dir1"; do rm -r /destination/dir/path find /source/dir/path/ -name .svn -exec rm -rf '{}' \; ...
0
votes
1answer
35 views

How to check if warning banners have been created in a shell script

What are the commands needed to run a script showing warning banners have been created with if else statement? Eg: If [something == something] echo " Banners created" else echo "Banners not ...
-8
votes
0answers
14 views

Comparing two files whose names are changing (Perl/Shell) [on hold]

I have two files which are generated with some numeric filenames, and I want to compare those files. The names of the files are changing. I'd like to do this in a Perl or shell script. Can anyone ...
-11
votes
0answers
26 views

Replace xml tag using sed command [on hold]

How do we find and replace the xml tag. My requirememt is to find and replace the xml tag if both the tag is present then replace with null. Appreciate your quicker reply. Thanks
2
votes
3answers
123 views

Assigning command to variable without alias

I just accidentally found out that in bash, we can assign a command into a variable without using alias. g=date $g Mon Jun 27 13:00:40 MYT 2016 That works. Here's another example: jj="ping yahoo....
-4
votes
2answers
26 views

Bash - Print lines containing at least all vowels in any order but no consecutives [solved]

The problem is to write a script that takes a file as argument and prints all the lines that contain -at least- all the vowels , -regardless of ordering-, but with [no two same consecutive vowels]. e....
1
vote
1answer
41 views

Extracting from Logs

Actual logs are: 2016-06-19 22:08:09 [213917] 1bEgCe-000tZR-E9 ** saadia@aol.com (fahad@manakintextiles.com) <fahad@manakintextiles.com> F=<james@designplus.com> P=<james@designplus....
17
votes
2answers
20k views

What is the purpose of using shift in bash scripts?

I have came across this script: #! /bin/bash ...
2
votes
2answers
148 views

How to convert several tiff images into xyz coordinates in a single text file using the terminal?

I have limited experience with programming and Linux and I need your help. The situation I am in is that I have a stack of black and white .tiff images (approx. 400 of 10 Mb each one) which I need to ...
-2
votes
0answers
35 views

script to add any 3 numbers in a file and print if it return 1000

I have file which contain 100 random numbers separated by newlines. I need to check if there are 3 numbers in that file which sums to a total of 1000. e.g. $ cat number.txt 500 100 50 50 400 The ...
0
votes
0answers
15 views

Delete command in Unix SQL loader [on hold]

When I use the delete statement in shell script, it deletes the record but in log it also shows as delete not found. Please respond if you have any idea on this. Below is sample statement I am using ...
2
votes
1answer
31 views

shell script echo text name in for looping multiple texts

I am trying to do this text1="word1 word2 word3" text2="word4 word5" text1="word6 word7 word8" for var in $text1 $text2 $text3 do echo $var" in "(__?__) done expected output word1 in text1 ...
-5
votes
1answer
34 views

Squaring all numbers in a file

Please, can someone share with me, or show me the script for Linux command to read from a file until EOF and compute the square of all numbers read. The result of this computation must be stored in an ...
1
vote
0answers
10 views

Shell script to grab one or many Wistia videos

What would be the best way to come up with a shell script that grabs one or many Wistia videos? There's plenty of proof-of-concepts out there for downloading YouTube videos via a shell script (i.e.: ...
0
votes
1answer
3k views

IBM V7000 scripts for monitoring

Hello (I'm no hard core coder:), I try to develop a script to do some very basic monitoring on an IBM SVC. My goal is to get some information about the nodes and my quroum status and then send ...
2
votes
1answer
31 views

How to suppress echo of buggy read function

I'm trying to capture a key press in a shell script (e.g. using read) and not to echo it. The three methods I found were stty -echo, the -s switch and stream redirection. However, on macOS, which ...
0
votes
1answer
1k views

CSH - How to check if input is NOT number

Please help, I can only see forums with this question for Bash, KSH, and others Need to apply it on csh. to check if the inputted $2 is not number nor the word "all" if ($#argv == 2 && ($2 !...
0
votes
1answer
43 views

how to write own shell that works with ssh [on hold]

I tried several tutorials I modified usermod -s shell path_to_binary username it does not work thru winscp, but works if use from Ubuntu terminal I want to own shell, where I can control over ...
4
votes
2answers
49 views

Compose string of IPs using bash command line

I have a command that returns the following: id1="172" id2="17" id3="136" id4="5" id5="0" /> id1="172" id2="17" id3="128" id4="2" id5="0" /> id1="172" id2="17" id3="128" id4="4" id5="0" />...
0
votes
1answer
41 views

sum of numbers located in different rows using awk

The following lines sum numbers located in the row #2 and row #3 , row #4 and row #5, row #6 and row #7 and so on (so, sum in a consecutive way). awk ' NR==1{$1=$1; print; next} !(NR%2){split($0,a);...
2
votes
2answers
34 views

Get only the size of a mounted filesystem

I want to get only the total size of a mounted filesystem. But the catch is that I only know about the mount point. So, I thought of using the df command. To get the size of this mounted filesystem, ...
1
vote
2answers
29 views

GNU Parallel and sshpass with server list in a loop

With this loop we sequential update on all servers (server list = consul members | grep awk {'print $2'} | cut -d ":" -f1) the package consul. for i in $(consul members | grep awk {'print $2'} | cut -...
0
votes
2answers
30 views

Generating strings of words with space delimiters from cut statement

I am new to bash. When I run the following command: grep "type" /root/myFile | cut-d'=' -f2 I get the following: 102 304 503 442 I want to store the contents of the first command into a ...
0
votes
0answers
9 views

Setting up SMTP-AUTH & people soft in Postfix

configured SMTP server in people soft -post fix for gmail authentication is not picking up correct sender name- configured in peopesoft- using default sender name as smtp-people soft@org.com this has ...
0
votes
0answers
28 views

How can I customize output of a command? [on hold]

One of my friends asked me how to customize the output of a command & I thought a bit but I can't find an acceptable answer. ( For example adding * at the start of every output of the find ...
0
votes
3answers
41 views

How to pick oldest file in a folder from directory [duplicate]

I had n number of files are there in my ../in/ directory. From those files I want the oldest file to process and send it to the ../complete/ directory. The remaining files are sent to the ../error/ ...
1
vote
2answers
132 views

Remove leading whitespace before possible shebang

I have a large collection of non-binary files in one place. Some of them have shebangs and of those some have (for some inexplicably reasons) whitespaces in front of the shebangs. This includes empty ...
3
votes
0answers
58 views

wait bash-builtin burns a CPU at 100 percent

Occurs at least on GNU bash version 4.3.42 x86_64 && GNU bash version 4.3.11 x86_64 I use sleep & wait $! instead of a simple sleep for getting an interruptible sleep by a signal (as ...
3
votes
1answer
41 views

Sort files into folders, depending on filetype

I have about 2.8TB (yes, terabytes) of data I have recovered, this will be scanned for duplicates, the machine these files reside on is quite old and only has 2GB of memory (works fine for LVM, ...
1
vote
1answer
51 views

insert the content between the matching pattern in shell script

I want to insert the content between the matching pattern in shell For example : file called input.txt : var a = [ ] file called output.txt : 1152 1185 1185 I want to insert the values ...
1
vote
2answers
8k views

How to remove a column or multiple columns from file using shell command?

My file, ARCHIVE B1_NAME B2_NAME B3_NAME ELEMENT INFO_NAM WERT PROCID -------- -------- -------- -------- -------- -------- ---- ------ ...
7
votes
1answer
377 views

Passing clicked links in rxvt to a script

I start my browser vimprobable in tabbed like so: "`tabbed -d > /tmp/tabbed.xid`; vimprobable2 -e `cat /tmp/tabbed.xid`" [1] I am then able to send all new instances of vimprobable to tabbed (and ...
0
votes
1answer
44 views

when i used sed -n ,why this err about sed -n ' $j,4800p' [duplicate]

LINEnum=$(grep -nr "#32" IM_DlCtrlRef.txt | cut -d : -f 1) for j in $LINEnum do echo $j sed -n '$j,4800p' IM_DlCtrlRef.txt >> IM_DlCtrlRef_bak for insertl in {1..4} do ...
3
votes
2answers
164 views

what is $$ in bash? [duplicate]

there is a script I evolved with it, it has line of command like below : mytemp=`echo ${sourcedir}|awk -F/ '{printf "/%s/tmp",$2}'`/`basename $0`-$1.$$ at the last of the command we see $$ that ...
15
votes
3answers
11k views

How to sort the string which combined with string + numeric using bash script?

This is the data what I want to sort. But sort treats the numeric to string, the data it no sorted as I expected. /home/files/profile1 /home/files/profile10 /home/files/profile11 /home/files/...
0
votes
2answers
41 views

Can I use a shebang to have a file source itself into current bash environment?

I have a growing collection of scripts which should be sourced, not run. At the moment they have the shebang #! /bin/cat but I would prefer the have them be sourced into bash when run, in the same ...
-6
votes
0answers
32 views

Write a Shell Script to generate a report named “Report_DDMMYYYY_HHMMSS.log” [on hold]

Write a Shell Script to generate a report named "DD_MM_YYYY_HH_MM_SS.log"which performs the following operations: 1) ** Display the number of files present in the given directory (Directory name ...
1
vote
2answers
438 views

How do I download PDFs from PubMed, given their IDs?

I have PubMed IDs for files I need to download from the PubMed site in .pdf format. I tried this script: #!/usr/bin/env bash Link="http://www.ncbi.nlm.nih.gov/pubmed/" ID=(10021369 ...
2
votes
2answers
44 views

Command behavior is different when executed by an other user (via su -c)

I want to kill every processes who match a specific chain. Here is my script, which works pretty well: echo `ps aux | grep verySpecificChain | grep -v grep | /usr/bin/awk '{ print $2 }'` | xargs kill ...
0
votes
2answers
38 views

Skip catching errors in bash

I have a script which compile a program. This program first compiles the source code using configure && make commands, then runs some tests using make test. This script also uses set -e to ...
0
votes
1answer
3k views

Any possibility to execute shell script from java file?

I have one Java file named app.java which extracts the servers in my application. I need to connect to every server in that list and extract the logs. In loop, I have to call script for connecting to ...
1
vote
1answer
48 views

Can I check if create_ap works?

I am currently using the script create_ap to emit a Wifi Access Point (WAP) using my Raspberry Pi, which is running Raspbian. How can I check if the AP is up and running using a bash script? For your ...
0
votes
0answers
53 views

Run console printing command after tmux starts up

I'm starting tmux from zsh with the window split into two panels. The only issue I'm having is screenfetch starts up and prints to both windows. Ideally I only want it printing on the left window. I ...
-1
votes
1answer
51 views

Syntax error at line 18 : `<<' is not matched

Here is my script #!/bin/bash stty intr ^C erase ^H kill ^U p_id=`ps -ef|grep iucmh|grep iuc|grep MSC015|grep START|awk -F" " '{print $2}'` vLogin=`echo "iucmh/iucmh123@4s_MH"` if [ -z "$p_id" ]; ...
0
votes
1answer
31 views

Using http remote MD5 hash

I would like to use the md5sums function of pkgbuild without keeping track of new hashsum at each update, and just change the pkgver variable to build a new version of my package. md5 are available ...
0
votes
1answer
52 views

Using multiple sed commands for text manipulation

I have a bash file, in which I would like to make several changes. sed -i 's/ / /g' testfile sed -i -e 's/#[a-z]$//' -e '/^$/d' testfile sed -i 's/ *$//' testfile sed '/##=/ r header' ...
2
votes
1answer
161 views

Print recursively all directories and subdirectories

I am trying to print all directories and sub directories with a recursive function but I get only the first directory. Any help? counter(){ list=`ls $1` if [ -z "$(ls $1)" ] then ...