2014-04-16 81 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 

只要沒有其他當前活動的子進程就會執行。

相關問題