Run a sequence commands in a sub shell like this:

(git pull;git rebase develop)&>/dev/null 

I think this will put the sub shell and all children processes created by it in background, and return control to user.

But actually, the terminal hang up for a while, seems it is wait for the commands to finish in sub shell.

So can anyone explain why this happened, and what is the right way to do this kind of job.

2 Answers 2


If you're running the bash shell, then &>/dev/null will redirect the standard output and error streams to /dev/null (it's the same as >/dev/null 2>&1), but it won't run the ( ... ) subshell as an asynchronous process. For that, you'll need to add an extra & at the end:

(git pull; git rebase develop) &>/dev/null &

ksh93 doesn't have this feature, and it's not in POSIX.


You can add sleep in your case and & at the end of command to put them in background,

(git pull; sleep 3; git rebase develop) &>/dev/null &

Alternatively you can use,

for cmd in $commands
    "$cmd" &

The & at the end of the command runs it in the background, and the wait waits until the background task is completed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .