Linux Bash strict mode
Links: 104 Linux Index
Bash strict mode¶
Linux - Bash strict mode - set commands¶
Linux - Bash strict mode - understanding IFS¶
Linux - Bash strict mode - issues and solutions¶
Summary¶
set -euo pipefail
IFS=$'\n\t' # mind the quotes and the dollar
# you may choose to not change the IFS.
-
Running the scripts in debug mode:
bash -x script.sh
- If you want to use debug mode in scripts then use
set -x
- If you want to use debug mode in scripts then use
-
Output of the following script in norma and debug mode
- It substitutes the variables for easy debugging.
++
means subshell command.
test=$(pwd)
# I use the below to output in debug mode. echo creates too much noise.
: ======== $test =========
echo $test
References¶
- Bash Strict Mode (redsymbol.net)
- wick/bash-strict-mode.md at master ยท tests-always-included/wick (github.com)
- bash "strict mode": -euo pipefail (beginner - intermediate) anthony explains #201 - YouTube
- why I use the colon (:) command (intermediate) anthony explains #505 - YouTube
- Print hack in debug mode.
Last updated: 2022-12-19