explaingit

koalaman/shellcheck

📈 Trending39,451HaskellAudience · ops devopsComplexity · 2/5ActiveLicenseSetup · easy

TLDR

Static analysis tool that scans shell scripts for bugs, quoting errors, and portability issues before they cause problems in production.

Mindmap

mindmap
  root((repo))
    What it does
      Finds shell script bugs
      Checks quoting errors
      Detects portability issues
    How to use it
      Web browser at shellcheck.net
      Command line tool
      Editor plugins
      CI/CD integration
    Use cases
      Automation scripts
      Build scripts
      Deployment tooling
    Tech stack
      Haskell
      Bash/sh parsing
    Audience
      Shell script writers
      DevOps engineers
      CI/CD maintainers

Things people build with this

USE CASE 1

Catch quoting and variable expansion bugs in automation scripts before they run in production.

USE CASE 2

Integrate into CI/CD pipelines to automatically reject shell scripts with warnings.

USE CASE 3

Get real-time feedback on shell script errors while editing in VS Code, Vim, or Emacs.

USE CASE 4

Learn common shell scripting pitfalls by reading ShellCheck's explanations for each warning.

Tech stack

HaskellBashShell scripting

Getting it running

Difficulty · easy Time to first run · 5min
Free to use and modify under GPLv3; you must share modifications and keep the license notice.

In plain English

ShellCheck is a static analysis tool for shell scripts, which means it reads your bash or sh script files and points out potential problems without actually running the code. Writing shell scripts is notoriously error-prone because the language has many subtle traps around quoting, variable expansion, and command substitution that can cause scripts to fail silently or behave unexpectedly on inputs the author did not anticipate. ShellCheck exists to catch these issues automatically before they cause problems in production. The tool works by parsing your shell script and applying a large set of rules derived from common shell scripting mistakes. It covers three levels of issues: syntax errors that beginners frequently make and that cause cryptic error messages, semantic problems that intermediate users encounter where the script runs but behaves counter-intuitively, and subtle edge cases and portability pitfalls that can trip up experienced developers. For each finding, ShellCheck provides a warning with a clear explanation and often a suggestion for how to fix it. You can try it instantly in a browser at shellcheck.net, run it from the command line, integrate it with editors like VS Code, Vim, and Emacs for inline highlighting, or add it to a CI pipeline to automatically fail builds that contain shell script warnings. You would use ShellCheck any time you write or maintain shell scripts, particularly automation scripts, build scripts, or deployment tooling where a subtle quoting bug could have serious consequences. It is also commonly added to CI/CD pipelines as a gating check to prevent problematic shell code from being merged. ShellCheck is written in Haskell and distributed as a pre-compiled binary for Linux, macOS, and Windows. It is available through most system package managers and can also be run as a Docker container. The project is licensed under GPLv3.

Copy-paste prompts

Prompt 1
I have a bash script that's failing silently on certain inputs. Run ShellCheck on it to find quoting or variable expansion bugs.
Prompt 2
How do I integrate ShellCheck into my GitHub Actions workflow to fail builds if shell scripts have warnings?
Prompt 3
What does ShellCheck warn about for this script: [paste script]. Explain each warning in plain English.
Prompt 4
Set up ShellCheck in VS Code so I get inline warnings while editing shell scripts.
Prompt 5
I want to understand why my shell script behaves differently on macOS vs Linux. What portability issues does ShellCheck find?
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.