Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ wait(1) — Motorola System V 88k Release 4 Version 4.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sh(1)

wait(1)  —  USER COMMANDS

NAME

wait − await completion of process

SYNOPSIS

wait [ n ]

DESCRIPTION

Wait for your background process whose process id is n and report its termination status.  If n is omitted, all your shell’s currently active background processes are waited for and the return code will be zero. 

When the wait(1) command is invoked with an argument that is not a valid pid of a background process, wait exits immediately with a return value of 0. This differs from the System V Release 3 behavior of the command. 

The shell itself executes wait, without creating a new process. 

EXAMPLE

command1 &
c1_pid=$!
command2
wait $c1_pid

This sequence will start command1 running in the background and remember its process ID in c1_pid, then execute command2.  When command2 finishes, the shell will wait until command1 is also finished before continuing. 

SEE ALSO

sh(1). 

NOTES

If you get the error message cannot fork, too many processes, try using the wait command to clean up your background processes.  If this doesn’t help, the system process table is probably full or you have too many active foreground processes.  (There is a limit to the number of process ids associated with your login, and to the number the system can keep track of.) 

Not all the processes of a 3- or more-stage pipeline are children of the shell, and thus cannot be waited for. 

  —  Essential Utilities

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026