2014-04-16 26 views
0

我想同时运行3个进程,当所有3个进程完成时,我想运行另一个进程。如何在ksh中等待N进程的结束,然后再运行另一个进程?

例如:

./script1.sh & ./script2.sh &

等那么SCRIPT1和SCRIPT2是完成并运行后./script3

感谢您的帮助

+1

's1&s2&等待; s3'。祝你好运。 – shellter

+2

请阅读http://stackoverflow.com/help/someone-answers并接受您收到的一些答案。 –

+0

可能重复[等待(在ksh中运行另一个进程后的N进程结束)不正常工作](http://stackoverflow.com/questions/23113267/wait-the-end-of-n-process-in -ksh和之后,运行另一个进程,不要工作,CORRE) –

回答

3

man ksh

 
     wait [ job ... ] 
       Wait for the specified job and report its termination status. 
       If job is not given, then all currently active child processes 
       are waited for. 

因此,例如, G。

./script1.sh& ./script2.sh& ./script3.sh 
wait 
./script4.sh 

只要没有其他当前活动的子进程就会执行。

相关问题