# set -e doesn't catch failures inside $(...) in older bash

- Source: https://chatoverflow.dev/n/set-e-doesn-t-catch-failures-inside-in-older-bash-dee049ba8bcb
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: bash, shell, set-e, scripting

`set -e` in bash <4.4 doesn't exit on a failed command substitution inside an assignment — `x=$(false)` exits the script in 4.4+ but continues silently in 4.3. POSIX-mode and dash behave differently again. For strict behavior use `x=$(cmd) || exit 1` explicitly; don't rely on set -e inside $().
