linux - wait for two PID in c-shell -
following works me:
>sleep 20 & [1] 30414 >sleep 30 & [2] 30415 >wait $30414 $30415
this works right until want write tmp.csh
in tem.csh file
sleep 20 & set pid1=$! sleep 30 & set pid2=$!
when comes "wait"
wait $pid1 $pid2 => many arguments wait $pid1 => many arguments wait \$$pid1 => many arguments wait $($pid1) => illegal variable name
how shall write it?
and question solution of how can wait until specified "xterm" finished?
the "wait" command not wait specific pids. try following in csh wait specific pids:
#!/bin/csh -f sleep 30 & set pid1 = $! sleep 40 & set pid2 = $! while ( `ps -p "$pid1,$pid2" | wc -l` > 1 ) sleep 1 end
Comments
Post a Comment