when writing shell scripts, I like to use the ShellCheck linter to highlight places I might have made a mistake (esp. quoting, looping, etc.)

https://www.shellcheck.net/

@williballenthin