http://unix.stackexchange.com/questions/124106/shell-script-wait-for-background-command
| You can use the command wait PID to wait for a process to end. You can also retrieve the PID of the last command with $! In your case, something like this: command1 & #run command1 in background
PID=$! #catch the last PID, here from command1
command2 #run command2 while command1 is running in background
wait PID #wait for command1, in background, to end
command3 #execute once command1 ended Following your edit, as you have multiple PIDs and you know them, you can do that: command1 & #run command1 in background
PID1=xxxxx
PID2=yyyyy
PID3=xxyyy
PID4=yyxxx
command2 #run command2 while command1 is running in background
wait PID1 PID2 PID3 PID4 #wait for the four processes of command1, in background, to end
command3 #execute once command1 ended |