Bash scripting comes with lots of footguns - the linter `shellcheck` can help avoid these: https://github.com/koalaman/shellcheck