KannanRG KannanRG - 2 years ago 78
Bash Question

Bash executing multiple commands in background in same line

When i try to execute

-bash-3.2$ cd /scratch/;nohup sh xyz.sh>>del.txt &;exit

I am getting following error..

-bash: syntax error near unexpected token `;'

I am trying to run a detached process using nohup .. & . ';' works fine for all other commands except
nohup sh xyz.sh>>del.txt &;

can anyone tell the problem here . Thanks

Answer Source

You can try putting your command between quotes if you are in a bash shell

cd /scratch/ ; `nohup sh xyz.sh>>del.txt &` ; exit

you can take a look at this question

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download