shellcheck

Statically check shell scripts for errors, usage of deprecated/insecure features, and bad practices. More information: https://github.com/koalaman/shellcheck/wiki.

shellcheck path/to/script.sh

shellcheck --shell sh|bash|dash|ksh path/to/script.sh

shellcheck --exclude SC1009,SC1073,... path/to/script.sh

shellcheck --check-sourced path/to/script.sh

shellcheck --format tty|checkstyle|diff|gcc|json|json1|quiet path/to/script.sh

shellcheck --enable add-default-case,avoid-nullary-conditions,... path/to/script.sh

shellcheck --list-optional

shellcheck --severity error|warning|info|style path/to/script.sh