by neves · 4y ago · 0 comments
My best shell advice is to put these commands at the beginning of every script:
set -e # stop scripts on errors
set -u # stop script if undefined var
set -o pipefail # stop script if there's a pipe failure
Use them to have a saner life. set -euo pipefailExample for set -e: https://mywiki.wooledge.org/BashFAQ/105
set -o errexit -o noclobber -o nounset -o pipefail
shopt -s failglob inherit_errexit
These are all easy to find in the Bash manual.