Just came across ShellCheck. From its About page:
ShellCheck is a static analysis and linting tool for sh/bash scripts. It’s mainly focused on handling typical beginner and intermediate level syntax errors and pitfalls where the shell just gives a cryptic error message or strange behavior, but it also reports on a few more advanced issues where corner cases can cause delayed failures.
Interestingly, the tool’s completely written with Haskell. You can copy/paste the script on the site, or even install it so you can conveniently check shell scripts every now and then. You need cabal
to have installed to compile the source. On Debian, you can install the package haskell-platform
to install cabal
.