diff --git a/CHANGELOG.md b/CHANGELOG.md index ce3977a..89c3418 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Released: Unreleased. [Commit log](https://github.com/kvz/bash3boilerplate/compare/v2.0.0...master) +- Introduce `errtrace`, which is on by default (BREAKING) - Add a configurable `helptext` that is left alone by the parses and allows you to have a richer help - Add a simple documentation website - Add best practice of using `__double_underscore_prefixed_vars` to indicate global variables that are solely controlled inside your script diff --git a/main.sh b/main.sh index 9c822d0..fe21843 100755 --- a/main.sh +++ b/main.sh @@ -37,6 +37,8 @@ # `set` is safer than relying on a shebang like `#!/bin/bash -e` because that is neutralized # when someone runs your script as `bash yourscript.sh` set -o errexit +# Exit on error inside any functions or subshells. +set -o errtrace set -o nounset # Bash will remember & return the highest exitcode in a chain of pipes.