wait - wait for process completion
wait [jobid]
The wait(1) command waits for the specified job(s) to finish. The jobid is specified either by the process identifier (ID) of the last process in the command pipeline, or by prefixing the job-number (revealed by the jobs(1) command) with a percent sign (%).
Other special job IDs are:
The wait(1) command will return if a signal for which a trap has been set is received, or if a HUP, INT or QUIT signal is received.
If no jobs are specified, wait(1) waits for all currently running jobs (if any) to finish and exits with a zero status. If job monitoring is enabled, the completion status of jobs is printed (this is not the case when jobs are explicitly specified).
The wait(1) command exits with the status of the last specified job, unless:
sh(1)