The set Command: -e, -u, -o pipefail

Updated

October 31, 2026

The set Command: -e, -u, -o pipefail

The Unofficial Bash Strict Mode ensures scripts fail fast on errors rather than continuing silently:

#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
  • -e (set -o errexit): Exit immediately if a pipeline returns a non-zero status.
  • -u (set -o nounset): Treat unset variables as an error and exit immediately.
  • -o pipefail: Return the exit status of the LAST command in a pipeline that failed (instead of ignoring upstream pipeline failures).