{"repo":"koalaman/shellcheck","free":true,"listed":false,"github":"https://github.com/koalaman/shellcheck","clone":"git clone https://github.com/koalaman/shellcheck.git","description":"ShellCheck, a static analysis tool for shell scripts","language":"Haskell","stars":39882,"topics":["bash","developer-tools","haskell","linter","shell","static-analysis"],"license":"GPL-3.0","category":"dev_tool","readme_excerpt":"[![Build Status](https://github.com/koalaman/shellcheck/actions/workflows/build.yml/badge.svg)](https://github.com/koalaman/shellcheck/actions/workflows/build.yml)\n\n\n# ShellCheck - A shell script static analysis tool\n\nShellCheck is a GPLv3 tool that gives warnings and suggestions for bash/sh shell scripts:\n\n![Screenshot of a terminal showing problematic shell script lines highlighted](doc/terminal.png)\n\nThe goals of ShellCheck are\n\n* To point out and clarify typical beginner's syntax issues that cause a shell\n  to give cryptic error messages.\n\n* To point out and clarify typical intermediate level semantic problems that\n  cause a shell to behave strangely and counter-intuitively.\n\n* To point out subtle caveats, corner cases and pitfalls that may cause an\n  advanced user's otherwise working script to fail under future circumstances.\n\nSee [the gallery of bad code](README.md#user-content-gallery-of-bad-code) for examples of what ShellCheck can help you identify!\n\n## Table of Contents\n\n* [How to use](#how-to-use)\n  * [On the web](#on-the-web)\n  * [From your terminal](#from-your-terminal)\n  * [In your editor](#in-your-editor)\n  * [In your build or test suites](#in-your-build-or-test-suites)\n* [Installing](#installing)\n* [Compiling from source](#compiling-from-source)\n  * [Installing Cabal](#installing-cabal)\n  * [Compiling ShellCheck](#compiling-shellcheck)\n  * [Running tests](#running-tests)\n* [Gallery of bad code](#gallery-of-bad-code)\n  * [Quoting](#quoting)\n  * [Conditionals](#conditionals)\n  * [Frequently misused commands](#frequently-misused-commands)\n  * [Common beginner's mistakes](#common-beginners-mistakes)\n  * [Style](#style)\n  * [Data and typing errors](#data-and-typing-errors)\n  * [Robustness](#robustness)\n  * [Portability](#portability)\n  * [Miscellaneous](#miscellaneous)\n* [Testimonials](#testimonials)\n* [Ignoring issues](#ignoring-issues)\n* [Reporting bugs](#reporting-bugs)\n* [Contributing](#contributing)\n* [Copyright](#copyright)\n* [Other Resources](#other-resources)\n\n## How to use\n\nThere are a number of ways to use ShellCheck!\n\n### On the web\n\nPaste a shell script on <https://www.shellcheck.net> for instant feedback.\n\n[ShellCheck.net](https://www.shellcheck.net) is always synchronized to the latest git commit, and is the easiest way to give ShellCheck a go. Tell your friends!\n\n### From your terminal\n\nRun `shellcheck yourscript` in your terminal for instant output, as seen above.\n\n### In your editor\n\nYou can see ShellCheck suggestions directly in a variety of editors.\n\n* Vim, through [ALE](https://github.com/w0rp/ale), [Neomake](https://github.com/neomake/neomake), or [Syntastic](https://github.com/scrooloose/syntastic):\n\n![Screenshot of Vim showing inlined shellcheck feedback](doc/vim-syntastic.png).\n\n* Emacs, through [Flycheck](https://github.com/flycheck/flycheck) or [Flymake](https://github.com/federicotdn/flymake-shellcheck):\n\n![Screenshot of emacs showing inlined shellcheck feedback](doc/emacs-flycheck.png).\n\n* Sublime, through [SublimeLinter](https://github.com/SublimeLinter/SublimeLinter-shellcheck).\n\n* Pulsar Edit (former Atom), through [linter-shellcheck-pulsar](https://github.com/pulsar-cooperative/linter-shellcheck-pulsar).\n\n* VSCode, through [vscode-shellcheck](https://github.com/timonwong/vscode-shellcheck).\n\n* Most other editors, through [GCC error compatibility](shellcheck.1.md#user-content-formats).\n\n### In your build or test suites\n\nWhile ShellCheck is mostly intended for interactive use, it can easily be added to builds or test suites.\nIt makes canonical use of exit codes, so you can just add a `shellcheck` command as part of the process.\n\nFor example, in a Makefile:\n\n```Makefile\ncheck-scripts:\n    # Fail if any of these files have warnings\n    shellcheck myscripts/*.sh\n```\n\nor in a Travis CI `.travis.yml` file:\n\n```yaml\nscript:\n  # Fail if any of these files have warnings\n  - shellcheck myscripts/*.sh\n```\n\nServices and platforms that have ShellCheck pre-installed and ready to use:\n\n* [Travis CI](https://travis-ci.org/)\n* [Codacy](https://www.codacy.com/)\n* [Code Climate](https://codeclimate.com/)\n* [Code Factor](https://www.codefactor.io/)\n* [Codety](https://www.codety.io/) via the [Codety Scanner](https://github.com/codetyio/codety-scanner)\n* [CircleCI](https://circleci.com) via the [ShellCheck Orb](https://circleci.com/orbs/registry/orb/circleci/shellcheck)\n* [Github](https://github.com/features/actions) (only Linux)\n* [Trunk Code Quality](https://trunk.io/code-quality) (universal linter; [allows you to explicitly version your shellcheck install](https://github.com/trunk-io/plugins/blob/bcbb361dcdbe4619af51ea7db474d7fb87540d20/.trunk/trunk.yaml#L32)) via the [shellcheck plugin](https://github.com/trunk-io/plugins/blob/main/linters/shellcheck/plugin.yaml)\n* [CodeRabbit](https://coderabbit.ai/)\n\nMost other services, including [GitLab](https://about.gitlab.com/), let you install\nShellCheck yourself, either through the system's package manager (see [Installing](#installing)),\nor by downloading and unpacking a [binary release](#installing-a-pre-compiled-binary).\n\nIt's a good idea to manually install a specific ShellCheck version regardless. This avoids\nany surprise build breaks when a new version with new warnings is published.\n\nFor customized filtering or reporting, ShellCheck can output simple JSON, CheckStyle compatible XML,\nGCC compatible warnings as well as human readable text (with or without ANSI colors). See the\n[Integration](https://github.com/koalaman/shellcheck/wiki/Integration) wiki page for more documentation.\n\n## Installing\n\nThe easiest way to install ShellCheck locally is through your package manager.\n\nOn systems with Cabal (installs to `~/.cabal/bin`):\n\n    cabal update\n    cabal install ShellCheck\n\nOn systems with Stack (installs to `~/.local/bin`):\n\n    stack update\n    stack install ShellCheck\n\nOn Debian based distros:\n\n    sudo apt install shellcheck\n\nOn Arch Linux based distros:\n\n    pacman -S shellcheck\n\nor get the dependency free [shellcheck-bin](https://aur.archlinux.org/packages/shellcheck-bin/) from the AUR.\n\nOn Gentoo based distros:\n\n    emerge --ask shellcheck\n\nOn EPEL based distros:\n\n    sudo yum -y install epel-release\n    sudo yum install ShellCheck\n\nOn Fedora based distros:\n\n    dnf install ShellCheck\n\nOn FreeBSD:\n\n    pkg install hs-ShellCheck\n\nOn macOS (OS X) with Homebrew:\n\n    brew install shellcheck\n\nOr with MacPorts:\n\n    sudo port install shellcheck\n\nOn OpenBSD:\n\n    pkg_add shellcheck\n\nOn openSUSE\n\n    zypper in ShellCheck\n\nOr use OneClickInstall - <https://software.opensuse.org/package/ShellCheck>\n\nOn Solus:\n\n    eopkg install shellcheck\n\nOn Windows (via [chocolatey](https://chocolatey.org/packages/shellcheck)):\n\n```cmd\nC:\\> choco install shellcheck\n```\n\nOr Windows (via [winget](https://github.com/microsoft/winget-pkgs)):\n\n```cmd\nC:\\> winget install --id koalaman.shellcheck\n```\n\nOr Windows (via [scoop](http://scoop.sh)):\n\n```cmd\nC:\\> scoop install shellcheck\n```\n\nFrom [conda-forge](https://anaconda.org/conda-forge/shellcheck):\n\n    conda install -c conda-forge shellcheck\n\nFrom Snap Store:\n\n    snap install --channel=edge shellcheck\n\nFrom Docker Hub:\n\n```sh\ndocker run --rm -v \"$PWD:/mnt\" koalaman/shellcheck:stable myscript\n# Or :v0.4.7 for that version, or :latest for daily builds\n```\n\nor use `koalaman/shellcheck-alpine` if you want a larger Alpine Linux based image to extend. It works exactly like a regular Alpine image, but has shellcheck preinstalled.\n\nUsing the [nix package manager](https://nixos.org/nix):\n```sh\nnix-env -iA nixpkgs.shellcheck\n```\n\nUsing the [Flox package manager](https://flox.dev/)\n```sh\nflox install shellcheck\n```\n\nAlternatively, you can download pre-compiled binaries for the latest release here:\n\n* [Linux, x86_64](https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz) (statically linked)\n* [Linux, armv6hf](https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.armv6hf.tar.xz), i.e. Raspberry Pi (statically linked)\n* [Linux, aarch64](https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.aarch64.tar.xz) aka ARM64 (statically linked)\n* [macOS, aarch64](https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.darwin.aarch64.tar.xz)\n* [macOS, x86_64](https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.darwin.x86_64.tar.xz)\n* [Windows, x86](https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.zip)\n\nor see the [GitHub Releases](https://github.com/koalaman/shellcheck/releases) for other releases\n(including the [latest](https://github.com/koalaman/shellcheck/releases/tag/latest) meta-release for daily git builds).\n\nThere are currently no official binaries for Apple Silicon, but third party builds are available via\n[ShellCheck for Visual Studio Code](https://github.com/vscode-shellcheck/shellcheck-binaries/releases).\n\nDistro packages already come with a `man` page. If you are building from source, it can be installed with:\n\n```console\npandoc -s -f markdown-smart -t man shellcheck.1.md -o shellcheck.1\nsudo mv shellcheck.1 /usr/share/man/man1\n```\n\n### pre-commit\n\nTo run ShellCheck via [pre-commit](https://pre-commit.com/), add the hook to your `.pre-commit-config.yaml`:\n\n```\nrepos:\n-   repo: https://github.com/koalaman/shellcheck-precommit\n    rev: v0.11.0\n    hooks:\n    -   id: shellcheck\n#       args: [\"--severity=warning\"]  # Optionally only show errors and warnings\n```\n\n### Travis CI\n\nTravis CI has now integrated ShellCheck by default, so you don't need to manually install it.\n\nIf you still want to do so in order to upgrade at your leisure or ensure you're\nusing the latest release, follow the steps below to install a binary version.\n\n### Installing a pre-compiled binary\n\nThe pre-compiled binaries come in `tar.xz` files. To decompress them, make sure\n`xz` is installed.\nOn Debian/Ubuntu/Mint, you can `apt install xz-utils`.\nOn Redhat/","default_branch":"master","files":90,"tree":[".claude/CLAUDE.md",".dockerignore",".ghci",".github/ISSUE_TEMPLATE/bug_report.md",".github/ISSUE_TEMPLATE/feature_request.md",".github/dependabot.yml",".github/workflows/build.yml",".github_deploy",".gitignore",".multi_arch_docker",".prepare_deploy",".vscode/extensions.json","CHANGELOG.md","Dockerfile.multi-arch","LICENSE","README.md","ShellCheck.cabal","builders/README.md","builders/build_builder","builders/darwin.aarch64/Dockerfile","builders/darwin.aarch64/build","builders/darwin.aarch64/tag","builders/darwin.x86_64/Dockerfile","builders/darwin.x86_64/build","builders/darwin.x86_64/tag","builders/linux.aarch64/Dockerfile","builders/linux.aarch64/build","builders/linux.aarch64/tag","builders/linux.armv6hf/Dockerfile","builders/linux.armv6hf/build","builders/linux.armv6hf/cabal.project.freeze","builders/linux.armv6hf/scutil","builders/linux.armv6hf/tag","builders/linux.riscv64/Dockerfile","builders/linux.riscv64/build","builders/linux.riscv64/tag","builders/linux.x86_64/Dockerfile","builders/linux.x86_64/build","builders/linux.x86_64/tag","builders/run_builder","builders/windows.x86_64/Dockerfile","builders/windows.x86_64/build","builders/windows.x86_64/tag","doc/emacs-flycheck.png","doc/shellcheck_logo.svg","doc/terminal.png","doc/vim-syntastic.png","manpage","nextnumber","quickrun","quicktest","setgitversion","shellcheck-dev.hs","shellcheck.1.md","shellcheck.hs","snap/snapcraft.yaml","src/ShellCheck/AST.hs","src/ShellCheck/ASTLib.hs","src/ShellCheck/Analytics.hs","src/ShellCheck/Analyzer.hs","src/ShellCheck/AnalyzerLib.hs","src/ShellCheck/CFG.hs","src/ShellCheck/CFGAnalysis.hs","src/ShellCheck/Checker.hs","src/ShellCheck/Checks/Commands.hs","src/ShellCheck/Checks/ControlFlow.hs","src/ShellCheck/Checks/Custom.hs","src/ShellCheck/Checks/ShellSupport.hs","src/ShellCheck/Data.hs","src/ShellCheck/Debug.hs","src/ShellCheck/Fixer.hs","src/ShellCheck/Formatter/CheckStyle.hs","src/ShellCheck/Formatter/Diff.hs","src/ShellCheck/Formatter/Format.hs","src/ShellCheck/Formatter/GCC.hs","src/ShellCheck/Formatter/JSON.hs","src/ShellCheck/Formatter/JSON1.hs","src/ShellCheck/Formatter/Quiet.hs","src/ShellCheck/Formatter/TTY.hs","src/ShellCheck/Interface.hs","src/ShellCheck/Parser.hs","src/ShellCheck/Prelude.hs","src/ShellCheck/Regex.hs","stack.yaml","striptests","test/buildtest","test/check_release","test/distrotest","test/shellcheck.hs","test/stacktest"],"storefront":"/r/koalaman","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/koalaman/shellcheck/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}