set -euo pipefail

The line many bash scripts put just under the shebang to turn on set -e, set -u and pipefail together.

In more detail

It makes a script stop at the first unhandled failure, unset variable or failing pipeline stage instead of carrying on with bad data. It is a safety net, not error handling: some failures slip past it, so still check the statuses that matter.

Examples

#!/usr/bin/env bash
set -euo pipefail
set -euo pipefail

Related terms

Taught in

References