Following works for me:
>sleep 20 &
[1] 30414
>sleep 30 &
[2] 30415
>wait $30414 $30415
This works all right until I want to write this into tmp.csh
In my tem.csh file
sleep 20 &
set pid1=$!
sleep 30 &
set pid2=$!
When it comes to "wait"
wait $pid1 $pid2 => too many arguments
wait $pid1 => too many arguments
wait \$$pid1 => too many arguments
wait $($pid1) => Illegal variable name
How shall I write it?
And this question is for a solution of How can I wait until specified "xterm" finished?
This works for me in tcsh:
It looks like that wait doesn't take any argument, just waits until every backgorunded process finish.
The "wait" command will not wait for specific PIDs. Try the following in CSH to wait for specific PIDs: