Wait (command)

Wait (command)

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

Usage

wait [n]

where n is the pid or job ID of a currently executing background process (job). If n is not given, 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, it is usually implemented as 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 (somewhat contrived) 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.


#!/bin/bash

# Parallel update script which makes use of the wait command

# Update local copyrsync iona:src/ . &
# Upgrade required libraries, or exit indicating failure if make failed for some reasonmake -C lib || exit 1

# Wait for rsync to terminate (may have already happened) and finish the job, unless rsync failedwait && make

ee also

* Wait (operating system)

External links

* [http://www.gnu.org/software/bash/manual/bashref.html GNU bash reference manual]


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Wait — or WAIT may refer to: * The act of waiting, see waiting (time) * wait (command), a computer shell command * wait (operating system), an operating system system call * Wait (musician), British town pipers * Wait (song), a song by The Beatles *… …   Wikipedia

  • Wait (operating system) — In modern computer operating systems, a process (or task) may wait on another process to complete its execution. In most systems, a parent process can create an independently executing child process. The parent process may then issue a wait… …   Wikipedia

  • Command \x26 Conquer: Red Alert 3 — Command Conquer: Red Alert 3 Command Conquer: Red Alert 3 Разработчик EA Los Angeles Издатель Electronic Arts …   Википедия

  • Command Loss Timer Reset — Command Loss Timer Reset(s) are part of the CCSDS communications system to spacecraft either in Earth orbit or beyond Earth orbit. The Command Loss Timer Reset, if it is not received in a timely manner by the spacecraft generally forces the… …   Wikipedia

  • wait — [[t]we͟ɪt[/t]] ♦ waits, waiting, waited 1) VERB: no passive When you wait for something or someone, you spend some time doing very little, because you cannot act until that thing happens or that person arrives. [V for n] I walk to a street corner …   English dictionary

  • Command & Conquer: Red Alert 3 — У этого термина существуют и другие значения, см. Red Alert. Command Conquer: Red Alert 3 Разработчик EA Los Angeles Издатель Electronic Arts Локализатор Sof …   Википедия

  • wait (команда) — У этого термина существуют и другие значения, см. Wait. wait  встроенная команда консольной оболочки Bash. Ждёт завершения указанного процесса и возвращает статус его завершения. Использование wait [n] где n может быть идентификатором… …   Википедия

  • Music of the Command & Conquer series — Command Conquer (often abbreviated as C C or CNC) is a video game franchise, mostly of the real time strategy style as well as a first person shooter game based on the former.[1] The Command Conquer series was initially developed by Westwood… …   Wikipedia

  • Hayes command set — The Hayes command set is a specific command language originally developed for the Hayes Smartmodem 300 baud modem in 1981. The command set consists of a series of short text strings which combine together to produce complete commands for… …   Wikipedia

  • Tagged Command Queuing — (TCQ) is a technology built into certain ATA and SCSI hard drives. It allows the operating system to send multiple read and write requests to a hard drive. ATA TCQ is not identical in function to the more efficient Native Command Queuing (NCQ)… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”