Link Search Menu Expand Document


Statically check shell scripts for errors, usage of deprecated/insecure features, and bad practices. More information:

  • Check a shell script:

shellcheck {{path/to/}}

  • Check a shell script interpreting it as the specified [s]hell dialect (overrides the shebang at the top of the script):

shellcheck --shell {{sh|bash|dash|ksh}} {{path/to/}}

  • Ignor[e] one or more error types:

shellcheck --exclude {{SC1009,SC1073,...}} {{path/to/}}

  • Also check any sourced shell scripts:

shellcheck --check-sourced {{path/to/}}

  • Display output in the specified [f]ormat (defaults to tty):

shellcheck --format {{tty|checkstyle|diff|gcc|json|json1|quiet}} {{path/to/}}

  • Enable one or more [o]ptional checks:

shellcheck --enable {{add-default-case,avoid-nullary-conditions,...}} {{path/to/}}

  • List all available optional checks that are disabled by default:

shellcheck --list-optional

  • Adjust the level of [S]everity to consider (defaults to style):

shellcheck --severity {{error|warning|info|style}} {{path/to/}}