The Bourne-Again SHell (Bash) is a successor to the Bourne shell (sh). Bash is the default shell in many Linux distributions.

learn more… | top users | synonyms (3)

1
vote
2answers
27 views

Unexpected EOF in .bashrc alias

I am getting an unexpected end of file error after including this line in my .bashrc alias domsrv01='echo -e ?HT_R8\'% | xclip ; ssh 10.50.0.35' The desired exit from echo to xclip is: ?HT_R8'% ...
0
votes
2answers
11 views

Bash: Find position of character in a string under OS X

Is there any way to find a position of a first character within a string in Bash under Mac OS X? Something like: stringZ=abcABC123ABCabc # 6 echo `expr index "$stringZ" C12` ...
1
vote
2answers
85 views

How to separate different values and make them variables

Want to separate different values and make them variables: db2 Attempting to contact (DESCRIPTION= (ADDRESS_LIST= (ADDRESS=(PROTOCOL=TCP)(HOST=server1)(PORT=1521))) (CONNECT_DATA=(SERVICE_NAME=db2))) ...
0
votes
2answers
22 views

Exit code of redirected command

So I want to verify the exit code of a specific command runuser -s /bin/bash @user_name -c $command > /dev/null 2>&1 & How can I find whether the command runuser -s /bin/bash ...
4
votes
5answers
5k views

How to kill all subprocesses of shell?

I'm writing bash script, which does several thing. In the beginning it starts several monitor scripts, each of them runs some other tools. At the end of my main script, I would like to kill all ...
54
votes
5answers
30k views

Basic bash script variable declaration - command not found

This seems like such a simple question I'm embarrassed to ask it: test.sh #!/bin/bash STR = "Hello World" echo $STR when I run sh test.sh I get this: test.sh: line 2: STR: command not found ...
2
votes
3answers
1k views

Using Case for Range of Numbers in Bash

I am trying to do the following using CASE in Bash (In Linux) If X is between 460 and 660, output X information. If X is between 661 and 800, do something else. Etc.. Right now this is what I ...
0
votes
1answer
16 views

Bash - moving a file and adding the date to the filename

#!/bin/bash while read server <&3; do #read server names into the while loop if [[ ! $server =~ [^[:space:]] ]] ; then #empty line exception continue fi echo "Connecting to - ...
0
votes
0answers
7 views

Automate xmodem file upload

I have a device where a software update is done by uploading a file through xmodem. I was able to do this in two ways using the lrzsz (http://ohse.de/uwe/software/lrzsz.html) package. 1) Using ...
1
vote
2answers
24 views

Find files and add a line

I am doing bash script and I need to add a line to all files of the type .info in a directory and subdirectories of that directory. The text I want to add is version = $version on new line in the ...
1
vote
1answer
18 views

How do I get a bash script working on FreeBSD, OpenBSD and Linux without modifying it?

Sorry, the headline might be a bit irritating, but I didn't know anything better. Anyway, I want a bash script to work on FreeBSD, OpenBSD and Linux without modifying it, but bash isn't located at the ...
1
vote
0answers
45 views

How to extract lines in between a file & read a part of a string with linux shell commands?

I have the following string (say, string1) as below: 20130403,012319 0 $GPRMC,012319.000,A,5055.1987,N,00624.5035,E,0.01,0.00,030413,,,A*63 I find the string length as 80. Now I want to ...
0
votes
1answer
17 views

PostgreSQL Command fom bash script

I work with PostgreSQL 9.2 and bash script. I have a problem. My DB is TestDB , Table name is config and my bash code is sudo -u postgres psql -c "select count(*) from public.config where ...
-1
votes
1answer
22 views

equivalent of rm and mv in windows .cmd

I have the following in a shell script,I want to convert the following lines into a windows cmd file..can anyone provide inputs on what is the equivalent for "rm" and "mv" in windows cmd file. rm -f ...
0
votes
1answer
20 views

converting while in shell script to windows command file

I have a shell script with sample code as follows..am trying to convert into a .cmd file.. can anyone provide inputs on what is the syntax for while and case in .cmd file? while getopts "c" flag do ...

1 2 3 4 5 1582
15 30 50 per page