set -u

Category: Shell & Bash

set -u

Treat unset variables as an error and exit

Treats any use of an undefined variable as an error and exits. Prevents bugs from typos in variable names.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.