Repolode
koalaman

koalaman/shellcheck

A static analysis tool that finds bugs, portability problems and bad habits in bash and sh shell scripts.

Stars
40,295
Forks
1,973
Open issues
1,090
Last commit
2 days ago

What is it?

ShellCheck reads shell scripts and reports warnings and suggestions about syntax mistakes, semantic problems and subtle pitfalls that can make a script misbehave or fail later. It targets bash and sh scripts and points out issues such as unquoted variables, misused test operators, broken find or grep patterns, and masked exit codes, with explanations for each warning.

It can be used on the web at shellcheck.net, from the command line, or inside editors such as Vim, Emacs, Sublime, VS Code and Pulsar. Output can be plain text, JSON, CheckStyle XML or GCC-style messages, and exit codes make it straightforward to fail a build or test run when warnings appear.

ShellCheck is written in Haskell and distributed under GPL-3.0. It is available through most system package managers, Docker, conda, and as pre-compiled binaries for Linux, macOS and Windows.

Key features

  • 01Detects quoting errors, broken conditionals and misused commands in bash and sh scripts.
  • 02Flags portability issues against the script's shebang, similar to checkbashisms.
  • 03Provides explanations for each warning with links to detailed wiki pages.
  • 04Integrates with many editors and CI services.
  • 05Outputs text, JSON, CheckStyle XML or GCC-compatible messages.

Use cases

  • Linting shell scripts in a CI pipeline so builds fail on new warnings.
  • Catching unquoted variables and dangerous rm or find patterns before running a script.
  • Checking that a script written for /bin/sh does not rely on bash-only features.
  • Getting inline feedback while editing shell scripts in your editor.

Quick start

  1. 1

    Install ShellCheck with Homebrew

    brew install shellcheck
  2. 2

    Run ShellCheck on a script

    shellcheck yourscript

Things to know

  • Licensed under GPL-3.0, a copyleft license.
  • Compiling from source requires about 2GB of RAM.

In collections

Topics

FAQ

What is shellcheck?
A static analysis tool that finds bugs, portability problems and bad habits in bash and sh shell scripts. ShellCheck reads shell scripts and reports warnings and suggestions about syntax mistakes, semantic problems and subtle pitfalls that can make a script misbehave or fail later. It targets bash and sh scripts and points out issues such as unquoted variables, misused test operators, broken find or grep patterns, and masked exit codes, with explanations for each warning.
Is shellcheck free to use? What license does it have?
shellcheck is open source under the GPL-3.0 license. Check the license terms before using it in commercial products.
Is shellcheck still maintained?
Actively maintained. The last commit to shellcheck was on Nov 5, 2026.
What can I use shellcheck for?
Linting shell scripts in a CI pipeline so builds fail on new warnings. Catching unquoted variables and dangerous rm or find patterns before running a script. Checking that a script written for /bin/sh does not rely on bash-only features. Getting inline feedback while editing shell scripts in your editor.
How do I install shellcheck?
Install ShellCheck with Homebrew: brew install shellcheck Run ShellCheck on a script: shellcheck yourscript
Where can I get shellcheck?
The source code and installation instructions are on GitHub: https://github.com/koalaman/shellcheck

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects