Are there any shell (specifically bash or ksh) checkers that test shell scripts for style, best practices, naming conventions, etc? (Something like Lint for C, or Perl::Critic for Perl.)
I know with ksh you can do syntax checking by running ksh -n script.ksh but I was hoping for something more than just sytax checking – something that parses/analyzes the actual code?
I’m probably out of luck, but I guess it doesn’t hurt to ask.
The Debian and Ubuntu projects use a script
checkbashisms, that looks for particular patterns that might indicate that someone is relying on/bin/shbeingbash.Beyond that, most shells have a
-noption to parse and report errors. You could check your script against several different shells to make sure it uses only portable syntax:edit to add: Since writing this answer, shellcheck has been written, as suggested in a later answer. This does a much more thorough job of linting shell scripts than the previous suggestions.