3 ms·
My current Bash go-to header now includes set -o errexit -o noclobber -o nounset -o pipefail - Exit the script at the first non-zero exit code. - Do not al
by l0b0 6y ago
My current Bash go-to header now includes
set -o errexit -o noclobber -o nounset -o pipefail
- Exit the script at the first non-zero exit code.
- Do not allow clobbering existing files (overridden on a per-line basis when I actually want to clobber).
- Exit the script at the first undefined and un-defaulted variable dereference.
- Fail if any part of a pipeline fails.
and
shopt -s failglob
- Treat a glob with no matches as an error.
A bonus of using long names is that they are easy to search for online.