wait builtin

The builtin that pauses a script until its background jobs, or one given job or process, have finished.

In more detail

It returns the exit status of the job it waited for. A script can therefore start several jobs in parallel and still check how each one ended.

Example

sleep 30 & kill -TERM %1; wait

Related terms

Taught in

References