set-option

Bash onecmd

Exits after reading and executing one command. A compound command or a whole parsed command list can count as one command; this is not a sandbox or a guarantee of one external process. Test two distinct input lines with the invocation flag. Run in a fresh private directory with HOME set to that directory and LC_ALL=C. Expected output (one item per line): first.

Formal Syntax & Structure

bash syntaxbash
bash -t; set -o onecmd

Return Value

exit status

See the example and command status; failures are nonzero.

Working Example

Example Snippetbash
printf '%s\n' 'printf "first\n"' 'printf "second\n"' | bash --noprofile --norc -t
Bash Reference