shellcheck
Statically check shell scripts for errors, usage of deprecated/insecure features, and bad practices. tldr-pages
On several platforms
Several platforms
Check a shell script
shellcheck path/to/script.shIdentifyCheck a shell script interpreting it as the specified shell dialect (overrides the shebang at the top of the script)
shellcheck --shell sh path/to/script.shIdentifyIgnore one or more error types
shellcheck --exclude SC1009,SC1073,... path/to/script.shIdentifyAlso check any sourced shell scripts
shellcheck --check-sourced path/to/script.shIdentifyDisplay output in the specified format (defaults to tty)
shellcheck --format tty path/to/script.shIdentifyEnable one or more optional checks
shellcheck --enable add-default-case,avoid-nullary-conditions,... path/to/script.shIdentifyList all available optional checks that are disabled by default
shellcheck --list-optionalIdentifyAdjust the level of severity to consider (defaults to style)
shellcheck --severity error path/to/script.shIdentify