Skip to content

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


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

    • If you want to use debug mode in scripts then use set -x
  • Output of the following script in norma and debug mode

    • attachments/Pasted image 20221219194622.jpg
    • It substitutes the variables for easy debugging.
    • ++ means subshell command.

# I use the below to output in debug mode. echo creates too much noise.
: ======== $test =========
echo $test


Last updated: 2022-12-19