The wait builtin command

wait [ID]

The wait builtin command is used to

  • wait for a specific job (asynchronous command) and report its exit status if the ID is given
  • wait for all running jobs (asynchronous commands)
  • wait for "the next" job (-n option)

Options

OptionDescription
-n Waits for "the next" child to exit (as opposed to "all children" without this option) - since 4.3-alpha

Return status

The return status is the return status of the job waited for, or

Status Reason
0 waited for all jobs in shell's job list
1 the given ID is not a valid job or process ID
Enter your comment. Wiki syntax is allowed: