wait
专为此设计:
./proc sth1 & ./proc sth2 & ./proc sth3 & ... & ./proc sthN &
wait
一些文档:
$ LANG=C help wait
wait: wait [id]
Wait for job completion and return exit status.
Waits for the process identified by ID, which may be a process ID or a
job specification, and reports its termination status. If ID is not
given, waits for all currently active child processes, and the return
status is zero. If ID is a a job specification, waits for all processes
in the job's pipeline.
Exit Status:
Returns the
身份证状态;如果 ID 无效或给出的选项无效,则失败。
另一种解决方案是获取所有 pid 并wait
为所有这些 pid 放置一个。