sequencer.sh - add functions to disable and enable errorcheck
This commit is contained in:
12
sequencer.sh
12
sequencer.sh
@@ -2,12 +2,20 @@
|
|||||||
# shellcheck disable=SC2034 # variable not used
|
# shellcheck disable=SC2034 # variable not used
|
||||||
# shellcheck disable=SC1090 # follow non constant source
|
# 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.
|
# Exit on error. Append "|| true" if you expect an error.
|
||||||
set -o errexit
|
set -o errexit
|
||||||
# Exit on error inside any functions or subshells.
|
# Exit on error inside any functions or subshells.
|
||||||
set -o errtrace
|
set -o errtrace
|
||||||
# Do not allow use of undefined vars. Use ${VAR:-} to use an undefined VAR
|
enableErrorCheck
|
||||||
set -o nounset
|
|
||||||
# Catch the error in case mysqldump fails (but gzip succeeds) in `mysqldump |gzip`
|
# Catch the error in case mysqldump fails (but gzip succeeds) in `mysqldump |gzip`
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
# Turn on traces, useful while debugging but commented out by default
|
# Turn on traces, useful while debugging but commented out by default
|
||||||
|
Reference in New Issue
Block a user