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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -