星期四, 二月 17, 2011

Wait other process to finish in a bash script

::::::::::::::
bar.sh
::::::::::::::
#!/usr/bin/env bash
sleep 5
echo bar.sh
::::::::::::::
foo.sh
::::::::::::::
#!/usr/bin/env bash
./bar.sh &
wait
echo foo.sh

When executing foo.sh, without the wait command, foo.sh will be echoed first, or it will be the last.

没有评论: