encyclopegia.org

Wait (command)

In Unix shells, wait is a command which pauses until execution of a background process has ended.

In Unix shells, wait is a command which pauses until execution of a background process has ended. ==Usage== wait [n...] where n... is a list of pids or job IDs of a currently executing background process (job). If no ids are provided, the command waits until all jobs known to the invoking shell have terminated. wait normally returns the exit status of the last job which terminated. It may also return 127 in the event that n specifies a non-existent job or zero if there were no jobs to wait for. Because wait needs to be aware of the job table of the current shell execution environment. Under the POSIX specifications it is required to be a shell builtin. ==Example== This command can be useful where part of a script can execute in parallel to implement a barrier where an upcoming section depends on the successful completion of the preceding sections. The following example will fetch the src/ directory from a machine named iona using rsync and simultaneously update the libraries on which this program depends, before building the combination. !/usr/bin/env bash Parallel update script which makes use of the wait command Update local copy rsync iona:src/ . & Upgrade required libraries, or exit indicating failure if make failed for some reason make -C lib || exit 1 Wait for rsync to terminate (may have already happened) and finish the job wait make Wait for specified job control id number: $ ls -R / > /dev/null 2>&1 & # start any long running background process [2] 1986 $ wait %2 # waits for background job number 2 to terminate, then returns ==See also== wait (system call) ==References== ==External links== GNU bash reference manual for the wait command

References

No reference rows published for this article.

Cite this article

MLA

"Wait (command)." encyclopegia.org, 2026, https://encyclopegia.org/wiki/wait-command. Accessed 24 November 2026.

Chicago

"Wait (command)." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/wait-command.

APA

encyclopegia.org. (2026). Wait (command). Retrieved November 24, 2026, from https://encyclopegia.org/wiki/wait-command

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1378920135 · 0.5 · snapshot enwiki-001378920135

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.