Starting bash scripts with set -euxo pipefail makes them safer.
set -eexit immediately when a command fails.set -o pipefailfail pipeline if any of the commands fail. By default the rightmost command’s exit code is used.set -utreat unset variables as an error and exit immediately.set -xprint each command before executing.
See https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/