Monday, November 4, 2013, useful site for sh/bash scripters

By Vasudev Ram

Saw this via a tweet by Cameron Laird (@Phaseit): 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 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:
while $a -lt 5
    echo $a
    a=`expr $a + 1`

and it found a couple of issues with it: that the backquotes are deprecated, and that expr is antiquated.

- Vasudev Ram - Dancing Bison Enterprises

Contact me

No comments: