Use ShellCheck to Lint Your Scripts
Although I’ve been moving over to writing more of my scripts in Ruby, I still find that I write a fair number of shell scripts to do various things on my Mac. I don’t write quite enough, however, to have internalized every best practice for writing them error free. A tool I love to use for this is ShellCheck.
It’s available in Homebrew and supported in Nova (via an extension) and BBEdit, which are the two editors I use most.
Give it a shot and enjoy less error-prone shell scripts.