jhy
jhy

Reputation: 233

set linux alias with background mode and multiple commands

I set the following linux alias command in .bashrc, but it does not work. Could some one tell me how to set it?

alias svngui='cd /home/personal_folders/j.jia/jhy_bin/WorkBench-1.6.8/Source; sh wb.sh&; cd -'

Upvotes: 1

Views: 624

Answers (3)

segfault
segfault

Reputation: 80

Your code will produce a syntax error which says "syntax error near unexpected token `;'". You need to enclosed your command with parentheses like this (sh wb.sh &);

So you can include your alias in .bashrc like this:

alias svngui='cd /home/personal_folders/j.jia/jhy_bin/WorkBench-1.6.8/Source; (sh wb.sh&); cd -'

Upvotes: 3

timgeb
timgeb

Reputation: 78700

Use parentheses in your alias:

alias foo='cd /dir/one ; (command &) ; cd /other/dir'

If it is okay to have wb.sh to be executed in a subshell. Redirect the output of command (sh wb.sh in your case) as needed.

Upvotes: 2

Karoly Horvath
Karoly Horvath

Reputation: 96266

You need either & or ;, &; is invalid.

Use &.

Upvotes: -1

Related Questions