Set shell options using set
and shopt
[GNU bash set builtin documentation]
# Set/unset xtrace
set -x # set
set +x # unset
# Set/unset xtrace by option name
set -o xtrace # set
set +o xtrace # unset
±x
,±o xtrace
: Print all executed commands±e
,±o errexit
: Exit on first non-zero exit code±o pipefail
: Use last failed pipe-command exit code as exit code
[GNU bash shopt builtin documentation]
# list options
shopt
# set option
shopt -s <option>
# unset option
shopt -u <option>
# query option
shopt -q <option> && echo "set" || echo "unset"