c - How can I wait until specified "xterm" finished? -
in c-shell file, did like:
xterm -e "source xxxx0" &
xterm -e "source xxxx1" &
wait
code....
it works fine code after "wait" executed after 2 xterm finished.
but gives problem. if have ps open, txt file opened geditn, or have eclipse open, hung there since "wait" waiting jobs finished.
so how can let "wait" wait 2 xterm jobs.
or in word, want 2 "xterm" run concurrently. , after both done, code can continued. how shall that?
thank much
tell wait
process ids should wait for:
xterm ... & pid1=$! xterm ... & pid2=$! wait $pid1 $pid2
that's assuming use shell wait
supports multiple arguments (bash,zsh, ...). if use sh portability, have 2 waits:
wait $pid1 wait $pid2
this wait untill both finished. if second finishes before first, wait return.
Comments
Post a Comment