diff --git a/sequencer.sh b/sequencer.sh index 8e44dcc..7f7633a 100755 --- a/sequencer.sh +++ b/sequencer.sh @@ -2,12 +2,20 @@ # shellcheck disable=SC2034 # variable not used # shellcheck disable=SC1090 # follow non constant source +enableErrorCheck() { +# Do not allow use of undefined vars. Use ${VAR:-} to use an undefined VAR + set -o nounset +} +disableErrorCheck() { +# Do not allow use of undefined vars. Use ${VAR:-} to use an undefined VAR + set +o nounset +} + # Exit on error. Append "|| true" if you expect an error. set -o errexit # Exit on error inside any functions or subshells. set -o errtrace -# Do not allow use of undefined vars. Use ${VAR:-} to use an undefined VAR -set -o nounset +enableErrorCheck # Catch the error in case mysqldump fails (but gzip succeeds) in `mysqldump |gzip` set -o pipefail # Turn on traces, useful while debugging but commented out by default