ShellCheck will critique your shell scripts, i.e. it’s a static checker for Bash etc. You can try it online at shellcheck.net. You can also install it on your own machines.
If you combine it with emac’s flycheck it is particularly delightful!
I had trouble installing it locally. I believe this recipe works. It’s written in Haskell, so first your install Haskell’s package manager cabal. I used brew cabal-install. Then do cabal update. At that point you clone shellcheck from github (git clone https://github.com/koalaman/shellcheck.git) and cd into the resulting directory cd shellcheck and run cabal install. Sometime later ~/.cabal/bin/shellcheck appears, and you can set flycheck-sh-shellcheck-executable so flycheck can find it.