Linters
What is ShellCheck? An introduction to the static analysis tool for shell scripts
ShellCheck is an open source static analysis tool that automatically finds bugs in shell scripts. It can detect many kinds of quoting issues as well as higher-level semantic problems. You can install it locally or try it online by pasting a script.
- Tool
- ShellCheck
- Made by
- ShellCheck
- Official site
- shellcheck.net
- Category
- Linters
Who makes ShellCheck
ShellCheck is published under the ShellCheck name, and its official website is linked below. The source code is available on GitHub, as is the website.
Official website: shellcheck.net
What ShellCheck is for
ShellCheck is for finding bugs in shell scripts without running them. As a static analysis tool, it reads the script and reports problems it can identify from the code itself.
It covers more than surface syntax. It can detect many kinds of quoting issues, and it can detect higher-level semantic problems. It also warns about portability problems when the shebang says sh, which helps when a script is meant to run in a plain sh environment.
Who ShellCheck is for
The vendor does not state a target audience. In practice, the facts point to anyone who writes shell scripts and wants automated checking of them.
The online option, where you paste a script, suits quick checks without setup. Developers who want it in their daily workflow can install it locally with several package managers or use it as an integrated linter in major editors. Teams that host code on GitHub can use it through CodeClimate, Codacy or CodeFactor.
Notable capabilities
ShellCheck combines bug detection with several ways to run it. The list below summarizes what it offers.
- Detection of many kinds of quoting issues in shell scripts.
- Detection of higher-level semantic problems.
- Portability warnings when the shebang says sh.
- Local installation with several package managers, and packaging for many distros and package managers.
- An online version where you paste a script to check it.
- Support as an integrated linter in major editors.
- Availability in CodeClimate, Codacy and CodeFactor to auto-check GitHub repositories.
- Documentation on the ShellCheck Wiki.
How ShellCheck fits linters
ShellCheck sits in the linters category as a tool focused on a single language family: shell scripts. It is written in Haskell and described as a static analysis tool, so it works on script text rather than on a running process.
Within Linthelm's wider niche of linters, static analysis and code quality, it shows how a narrow tool can be placed at several points in a workflow: in the editor while writing, on the command line after a local install, and in hosted services that check GitHub repositories automatically. Because it is open source, with its source code on GitHub, its behavior is open to inspection, and the ShellCheck Wiki provides documentation for its checks.
Frequently asked questions
What is ShellCheck used for?
ShellCheck is used to automatically find bugs in shell scripts. It can detect many kinds of quoting issues and higher-level semantic problems.
Can I try ShellCheck online?
Yes. It can be tried online by pasting a script. It can also be installed locally with several package managers.
Does ShellCheck work in editors?
Yes. It is supported as an integrated linter in major editors.
Does ShellCheck check portability?
It warns about portability problems when the shebang says sh.
What language is ShellCheck written in?
ShellCheck is written in Haskell, and its source code is available on GitHub.
Linthelm is independent and is not affiliated with ShellCheck. Product names belong to their owners. Features change; confirm details on the official website.