set-option
errtrace
Inherit ERR traps in functions, command substitution and subshell environments; does not remove ERR exception contexts.
Formal Syntax & Structure
bash syntaxbash
set -E; set +EReturn Value
shell option
Inherit ERR traps in functions, command substitution and subshell environments; does not remove ERR exception contexts.
Working Example
Example Snippetbash
trap 'printf "ERR=%s\n" "$?" >&2' ERRwork() { false; printf 'work continued\n'; }set +Eworkset -Ework