Bash Strict Mode
Bash is well-known to be a hard language to write in, with many somewhat nonintuitive syntax requirements and edge cases. However, unlike some languages like Perl or Python, bash is available on basically every Unix machine and is the lingua franca for systems scripting making it very hard to avoid. Therefore, adding this snippet to the top of every script will avoid issues and make errors easier to debug.
set -exuo pipefail IFS=$'\n\t'
shellcheck to lint bash code and suggest fixes.