set-option

errexit

Exit on certain unhandled failures; exceptions include conditional tests, nonfinal AND/OR and pipeline positions, and negation. Tested function contexts can suppress it. Not an exception framework.

Formal Syntax & Structure

bash syntaxbash
set -e; set +e

Return Value

shell option

Exit on certain unhandled failures; exceptions include conditional tests, nonfinal AND/OR and pipeline positions, and negation. Tested function contexts can suppress it. Not an exception framework.

Working Example

Example Snippetbash
bash -c 'set -e; printf "before\n"; false; printf "after\n"'printf 'child=%s\n' "$?"
Bash Reference