set -e and Conditions
With set -e, why doesn't the script stop when check_db fails in if check_db; then …; fi?
set -e
check_db
if check_db; then …; fi
Choose one answer
Functions never trigger set -e.
Commands tested by if are exempt from set -e.
if
set -e only applies to commands run with sudo.
sudo
set -e must be enabled again inside every if block of the script.