update title for bash strict mode, add command to turn it off

This commit is contained in:
Bonnie I-Man Ng 2023-03-11 17:08:42 +00:00
parent 6ecdb7b85e
commit 40c3b7d7b8

View File

@ -3278,7 +3278,7 @@ dd if=/dev/zero of=/dev/shm/200m bs=1M count=200
watch -n 1 wc -l filename watch -n 1 wc -l filename
``` ```
##### Un/Safely pipeline ##### Use Bash Strict Mode
```bash ```bash
# These options can make your code safer but, depending on how your pipeline is written, it might be too aggressive # These options can make your code safer but, depending on how your pipeline is written, it might be too aggressive
# or it might not catch the errors that you are interested in # or it might not catch the errors that you are interested in
@ -3296,7 +3296,11 @@ set -Eue -o pipefail # shorthand for above (pipefail has no short option)
##### Print commands and their arguments when execute (e.g. echo `expr 10 + 20 `) ##### Print commands and their arguments when execute (e.g. echo `expr 10 + 20 `)
```bash ```bash
set -x; echo `expr 10 + 20 ` set -x; echo `expr 10 + 20 `
set -o xtrace; echo `expr 10 + 20 ` # this might be easier to remember # or
set -o xtrace; echo `expr 10 + 20 `
# to turn it off..
set +x
``` ```
##### Print some meaningful sentences to you (install fortune first) ##### Print some meaningful sentences to you (install fortune first)