That should catch most of the issues, but if you want to get real crazy, this is from the head of my bash scripts

#!/usr/bin/env bash

set -o errexit # exit on error
set -o errtrace # exit on error inside function/subshell
set -o nounset # no undef vars. use ${VAR:-} for undef
set -o noglob # disable globbing
set -o pipefail # catch error on pipe fail
# set -o xtrace # turn on traces
# }}}

Sign in to participate in the conversation is a Mastodon instance hosted in Germany and powered by 100% green energy.