在c-shell中等待两个PID [英] wait for two PID in c-shell
本文介绍了在c-shell中等待两个PID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下对我有用的东西
>sleep 20 &
[1] 30414
>sleep 30 &
[2] 30415
>wait $30414 $30415
此方法正常直到我想将其写入tmp.csh
This works all right until I want to write this into tmp.csh
在我的tem.csh文件中
In my tem.csh file
sleep 20 &
set pid1=$!
sleep 30 &
set pid2=$!
谈到等待时
wait $pid1 $pid2 => too many arguments
wait $pid1 => too many arguments
wait \$$pid1 => too many arguments
wait $($pid1) => Illegal variable name
我应该怎么写?
这个问题是针对
的解决方案如何我可以等到指定的 xterm
推荐答案
这在tcsh中对我有用:
This works for me in tcsh:
#!/bin/tcsh
time
sleep 10 &
sleep 5 &
wait
time
看起来,等待没有任何论点,只需等到每个重新组合的进程完成。
It looks like that wait doesn't take any argument, just waits until every backgorunded process finish.
这篇关于在c-shell中等待两个PID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文