ShellCheck: Shell script analysis tool

[ gpl, library, program, static-analysis ] [ Propose Tags ]

The goals of ShellCheck are:

[Skip to Readme]
Versions [RSS] [faq] 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.3.7, 0.3.8, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.4.5, 0.4.6, 0.4.7, 0.5.0, 0.6.0, 0.7.0, 0.7.1, 0.7.2 (info)
Dependencies base (==4.*), containers, directory, json, mtl, parsec, QuickCheck (>=2.7.4), regex-tdfa, ShellCheck, transformers [details]
License GPL-3.0-only
Author Vidar Holen
Category Static Analysis
Home page
Bug tracker
Source repo head: git clone git://
Uploaded by vidarhol at 2015-06-20T17:53:14Z
Distributions Arch:0.7.2, Debian:0.5.0, Fedora:0.7.2, FreeBSD:0.3.8, LTSHaskell:0.7.2, NixOS:0.7.2, Stackage:0.7.2, openSUSE:0.7.1
Executables shellcheck
Downloads 41115 total (386 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2015-06-20 [all 1 reports]




Maintainer's Corner

For package maintainers and hackage trustees


Readme for ShellCheck-0.3.8

[back to package description]

ShellCheck - A shell script static analysis tool

Copyright 2012-2015, Vidar 'koala_man' Holen Licensed under the GNU General Public License, v3

The goals of ShellCheck are:

  • To point out and clarify typical beginner's syntax issues, that causes a shell to give cryptic error messages.

  • To point out and clarify typical intermediate level semantic problems, that causes a shell to behave strangely and counter-intuitively.

  • To point out subtle caveats, corner cases and pitfalls, that may cause an advanced user's otherwise working script to fail under future circumstances.

ShellCheck is written in Haskell, and requires 2 GB of memory to compile.


On systems with Cabal:

cabal update
cabal install shellcheck

On Debian based distros:

apt-get install shellcheck

On OS X with homebrew:

brew install shellcheck

ShellCheck is also available as an online service:

Building with Cabal

This sections describes how to build ShellCheck from a source directory.

First, make sure cabal is installed. On Debian based distros:

apt-get install cabal-install

On Fedora:

yum install cabal-install

On Mac OS X with homebrew (

brew install cabal-install

On Mac OS X with MacPorts (

port install hs-cabal-install

On native Windows (

Download and install the latest version of the Haskell Platform.

Let cabal update itself, in case your distro version is outdated:

$ cabal update
$ cabal install cabal-install

With cabal installed, cd to the ShellCheck source directory and:

$ cabal install

This will install ShellCheck to your ~/.cabal/bin directory.

Add the directory to your PATH (for bash, add this to your ~/.bashrc):

export PATH="$HOME/.cabal/bin:$PATH"

Verify that your PATH is set up correctly:

$ which shellcheck

On native Windows, the PATH should already be set up, but the system may use a legacy codepage. In cmd.exe, powershell.exe and Powershell ISE, make sure to use a TrueType font, not a Raster font, and set the active codepage to UTF-8 (65001) with chcp:

> chcp 65001
Active code page: 65001

In Powershell ISE, you may need to additionally update the output encoding:

> [Console]::OutputEncoding = [System.Text.Encoding]::UTF8

Running tests

To run the unit test suite:

cabal configure --enable-tests
cabal build
cabal test

Happy ShellChecking!