command-syntax

Bash asynchronous list

Launch a list without waiting; save $! and wait for its completion status.

Formal Syntax & Structure

bash syntaxbash
list &

Return Value

exit status

Launch a list without waiting; save $! and wait for its completion status.

Working Example

Example Snippetbash
( printf 'work\n'; exit 4 ) > work.txt &pid=$!wait "$pid"status=$?cat work.txtprintf 'status=%s\n' "$status"
Bash Reference