Analyse shell scripts
shellcheck [ -f format ] [ -e code ] [ -s shell ] files
shellcheck syntactically analyzes shell scripts and points out typical issues. Among other things, it is able to spot wrong usage of unicode characters, non-matching parentheses, wrong spacing, usage of features unavailable to the selected shell, corner cases with respect to quoting, needlessly complex snippets and unused variables. The analysis does not actually execute any shell commands.
-f format, --format format
Select the format used for printing diagnostics. Available formats are checkstyle (XML based format), gcc, json and and tty (colorful). The default format is tty.
-e code, --exclude code
Suppress emission of given diagnostic codes. Diagnostic codes consist of four decimal digits. To suppress multiple codes, the option can be given multiple times or codes can be separated using commas.
-s shell, --shell shell
Select shell dialect. Available shells are bash, ksh (Korn shell), sh (POSIX compatible), and zsh. If this option is not given, the dialect is guessed from the shebang. Defaults to bash.
shellcheck was written by Vidar Holen.
This manual page was written by Helmut Grohne for the Debian project (but may be used by others).