Skip to content

Bash strict mode

Turn on errexit, nounset, pipefail, and a safer IFS, plus xtrace when DEBUG is set.

18th August 2026

set -o errexit
set -o nounset
set -o pipefail
[[ -n ${DEBUG:-} ]] && set -o xtrace
IFS=$'\n\t'

Caveats

grep -c and unset variables need || true and ${VAR:-} under these options.