shellcheck
ShellCheck, a static analysis tool for shell scripts
What is shellcheck?
ShellCheck, a static analysis tool for shell scripts
Overview of shellcheck
What it is
ShellCheck is a GPL-3.0 static analysis tool for bash/sh shell scripts. It gives warnings and suggestions. Its goals are to point out and clarify typical beginner's syntax issues that cause cryptic shell error messages, intermediate semantic problems that cause strange behavior, and subtle caveats, corner cases, and pitfalls that may cause an advanced user's working script to fail under future circumstances. It can be used on the web, from a terminal, in editors, and in build or test suites.
Key features
- Provides warnings and suggestions for bash/sh shell scripts.
- Identifies beginner syntax issues, intermediate semantic problems, and subtle caveats and pitfalls.
- Runs from the terminal with
shellcheck yourscript. - Integrates with editors including Vim, Emacs, Sublime, Pulsar Edit, VSCode, and others through GCC error compatibility.
- Can be added to builds or test suites and uses exit codes.
- Outputs human-readable text, JSON, CheckStyle-compatible XML, and GCC-compatible warnings.
- Is pre-installed on services and platforms such as Travis CI, Codacy, Code Climate, Code Factor, CircleCI via the ShellCheck Orb, GitHub on Linux, Trunk Code Quality, and CodeRabbit.
Use cases
Use ShellCheck to review shell scripts interactively, to check scripts in a Makefile or CI configuration, and to see suggestions in supported editors. It is intended mostly for interactive use but can be added to builds or test suites. It can also be used on the web by pasting a shell script for instant feedback.
Getting started
Install through a package manager, or use one of the README's commands. sh sudo apt install shellcheck shellcheck yourscript
License and pricing
ShellCheck is licensed under GPL-3.0. Metadata lists the pricing type as open source. No pricing is stated.
Based on the project's public README and repository metadata.