Saw this via a tweet by Cameron Laird (@Phaseit):
ShellCheck.net is a web site where you can paste in your sh or bash script, and it will statically analyse and lint it.
Excerpt from the ShelllCheck.net site:
[ 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. ]
Apparently the tool is written in Haskell.
I tried it with the default example shown, and it seems to work, since it gave 5 errors or warnings about the code.
I then tried it again with this simple shell script:
a=1 while $a -lt 5 do echo $a a=`expr $a + 1` done
and it found a couple of issues with it: that the backquotes are deprecated, and that expr is antiquated.
- Vasudev Ram - Dancing Bison Enterprises