ShellCheck VS sh

Compare ShellCheck vs sh and see what are their differences.

ShellCheck

ShellCheck, a static analysis tool for shell scripts (by koalaman)

sh

A shell parser, formatter, and interpreter with bash support; includes shfmt (by mvdan)
Our great sponsors
  • Scout APM - A developer's best friend. Try free for 14-days
  • Nanos - Run Linux Software Faster and Safer than Linux with Unikernels
  • SaaSHub - Software Alternatives and Reviews
ShellCheck sh
177 9
26,914 4,280
- -
8.6 8.7
14 days ago 5 days ago
Haskell Go
GNU General Public License v3.0 only BSD 3-clause "New" or "Revised" License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

ShellCheck

Posts with mentions or reviews of ShellCheck. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-11-26.

sh

Posts with mentions or reviews of sh. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-09-29.
  • Code formatter, linters, etc. Recommendations?
    4 projects | reddit.com/r/bash | 29 Sep 2021
    There is shellcheck, and shellharden which is a strict version of it. There are similar stuff here, some that also help with your editor. You can also use a docker version of shfmt. See here for a quick tutorial on shfmt.
  • First Bash Script
    2 projects | reddit.com/r/bash | 23 Sep 2021
    Now go ahead and install shellcheck and shfmt to get even better at it.
  • How can I fix this install script to detect archives, and what are the strange numbers for the permissions? Plz help me understand.
    5 projects | reddit.com/r/bash | 6 Jul 2021
    INSTALL_DIR=/usr/local/bin # Call with arguments (location,filename,sha,name,strip) function download_verify_install() { curl -LOf "${1}${2}" echo "${3} ./${2}" | sha512sum --check tar -C $INSTALL_DIR/ -xf "${2}" --no-anchored "${4}" --strip="${5}" } install_redhat_binaries() { BOLD=$(tput bold) RESET=$(tput sgr0) set -euo pipefail local PANDOC_LOCATION=https://github.com/jgm/pandoc/releases/download/2.11.2/ local PANDOC_FILENAME=pandoc-2.11.2-linux-amd64.tar.gz local PANDOC_SHA=9d265941f224d376514e18fc45d5292e9c2481b04693c96917a0d55ed817b190cf2ea2666097388bfdf30023db2628567ea04ff6b9cc3316130a8190da72c605 local SHELLCHECK_LOCATION=https://github.com/koalaman/shellcheck/releases/download/v0.7.2/ local SHELLCHECK_FILENAME=shellcheck-v0.7.2.linux.x86_64.tar.xz local SHELLCHECK_SHA=067e2b8ee1910218de1e62068f7cc86ed7048e97b2a9d7c475ea29ae81c17a944376ce5c240d5c783ef3251d9bee7d7d010351958314eadd0fc88b5decfd8328 local SHFMT_LOCATION=https://github.com/mvdan/sh/releases/download/v3.2.2/ local SHFMT_FILENAME=shfmt_v3.2.2_linux_amd64 local SHFMT_SHA=d4e699575899f7c44dbce54f6414fb63c0527e7d743ea724cb0091417e07a353c1d156d4184580a260ca855cdf5e01cdf46b353f04cf5093eba3ffc02223f1c6 local BAT_LOCATION=https://github.com/sharkdp/bat/releases/download/v0.18.1/ local BAT_FILENAME=bat-v0.18.1-x86_64-unknown-linux-gnu.tar.gz local BAT_SHA=5ccab17461d2c707dab2e917daacdabe744c8f8c1e09330c03f17b6f9a9be3d79d8a2786c5e37b1bdbdb981e9d9debfec909b4a99bf62329d6f12c1c3e8dfcb7 local RIPGREP_LOCATION=https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ local RIPGREP_FILENAME=ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz local RIPGREP_SHA=cdc18bd31019fc7b8509224c2f52b230be33dee36deea2e4db1ee8c78ace406c7cd182814d056f4ce65ee533290a674822432777b61c2b4bc8cc4a4ea107cfde echo -e "${BOLD}Installing binaries for RHEL clones not available in repositories...${RESET}\n" download_verify_install "$PANDOC_LOCATION" "$PANDOC_FILENAME" "$PANDOC_SHA" "pandoc" 2 download_verify_install "$SHELLCHECK_LOCATION" "$SHELLCHECK_FILENAME" "$SHELLCHECK_SHA" "shellcheck" 1 download_verify_install "$BAT_LOCATION" "$BAT_FILENAME" "$BAT_SHA" "bat" 1 download_verify_install "$RIPGREP_LOCATION" "$RIPGREP_FILENAME" "$RIPGREP_SHA" "rg" 1 # download_verify "$SHFMT_LOCATION" "$SHFMT_FILENAME" "$SHFMT_SHA" # chmod +x $SHFMT_FILENAME # mv $SHFMT_FILENAME $INSTALL_DIR/shfmt } install_redhat_binaries
  • Config to edit bash scripts with fancy LSP features, linting and formatting
    7 projects | reddit.com/r/vim | 17 Jun 2021
    Does anybody have such? Maybe you could share your experience? I use coc.nvim. My eyes fell on these 3 tools. The first one is language server and it has coc extensions coc-sh. But others are not so I am not sure which vim plugin should I use to hook them up: besides diagnostic-languageserver there are syntastic and neomake - bash-language-server - shellcheck - shfmt
  • How to get diagnostics in BASH scripts (.sh files) with Native LSP?
    4 projects | reddit.com/r/neovim | 17 May 2021
    I also use shfmt with efm-langserver too. Shfmt provides auto-formatting. For completions I use bash-language-server with native lsp.
  • Linux Minecraft Server built - Cheapo mode + rsync backup
    2 projects | reddit.com/r/admincraft | 12 May 2021
    Use shellcheck and shfmt. Even if the script is just for you ... these will help you avoid hair pulling but stupid bugs (like a misspelled variable).
  • Bash-LSP: A language server for Bash
    6 projects | news.ycombinator.com | 1 Apr 2021
  • Format Code The Vim Way
    2 projects | reddit.com/r/vim | 23 Mar 2021
    I remember learning about formatprg when I was just learning about vim. But it went over my head then! I am very glad for this video. I think I'll try out https://github.com/mvdan/sh as a format program next time I have to shill out some shell.
  • ShellCheck: A static analysis tool for shell scripts
    12 projects | news.ycombinator.com | 18 Mar 2021
    This is one of my favorite tips for almost effortlessly improving devops productivity (along with using https://github.com/mvdan/sh for auto-formatting) โ€” by now shellcheck has good editor support in e.g. VSCode and I have a standard pre-commit.com hook for all of my projects. I've seen so many long iterations where people flail at a complex shell script for something like a cron job which was immediately flagged by shellcheck. I generally recommend rewriting in Python but this is a good less invasive step.

    One thing which might be worth considering is adding this to your personal ~/.shellcheckrc to make it more pedantic:

    enable=all

What are some alternatives?

When comparing ShellCheck and sh you can also consider the following projects:

bash-language-server - A language server for Bash

efm-langserver - General purpose Language Server

ohmyzsh - ๐Ÿ™ƒ A delightful community-driven (with 1900+ contributors) framework for managing your zsh configuration. Includes 300+ optional plugins (rails, git, macOS, hub, docker, homebrew, node, php, python, etc), 140+ themes to spice up your morning, and an auto-update tool so that makes it easy to keep up with the latest updates from the community.

proot - An chroot-like implementation using ptrace.

neomake - Asynchronous linting and make framework for Neovim/Vim

bat - A cat(1) clone with wings.

babashka - Native, fast starting Clojure interpreter for scripting

stan - ๐Ÿ•ต๏ธ Haskell STatic ANalyser

PowerShell - PowerShell for every system!

maam - A monadic approach to static analysis following the methodology of AAM

shellharden - The corrective bash syntax highlighter

toml - TOML parser for Golang with reflection.