Skip to content

Instantly share code, notes, and snippets.

@robin-a-meade
robin-a-meade / unofficial-bash-strict-mode.md
Last active November 15, 2024 11:51
Unofficial bash strict mode

Unofficial Bash Strict Mode

Sometimes a programming language has a "strict mode" to restrict unsafe constructs. E.g., Perl has use strict, Javascript has "use strict", and Visual Basic has Option Strict. But what about bash? Well, bash doesn't have a strict mode as such, but it does have an unofficial strict mode:

set -euo pipefail

set -e