Static analysis tool that identifies syntax errors, semantic issues, and pitfalls in bash/sh shell scripts
ShellCheck is a static analysis tool that examines bash and sh shell scripts to identify potential issues across multiple categories of problems. It detects syntax errors that cause cryptic shell error messages, semantic problems that lead to unexpected behavior, and subtle pitfalls that could cause scripts to fail under specific circumstances.
The tool operates through multiple interfaces: a web version at shellcheck.net for instant feedback, a command-line interface that runs as shellcheck yourscript, and integrations with editors like Vim, Emacs, VS Code, and Sublime Text. ShellCheck can also be integrated into CI/CD pipelines and build systems, making canonical use of exit codes for automated testing.
ShellCheck outputs results in various formats including human-readable text, JSON, CheckStyle XML, and GCC-compatible warnings. It supports inline suppression of specific warnings through special comments and can be configured for different severity levels. The tool is particularly valuable for developers working with shell scripts in production environments, DevOps engineers building deployment scripts, and system administrators maintaining automation tools.
The project includes extensive documentation with a gallery of problematic code examples covering quoting issues, conditional logic errors, command misuse, portability problems, and robustness concerns. Pre-compiled binaries are available for Linux (x86_64, ARM), macOS, and Windows platforms.
# via Homebrew
brew install shellcheck
# via APT
sudo apt install shellcheck
# via Cabal
cabal install ShellCheck


