CentOS Stream 8: Install ShellCheck for Static Analyzer

Download binary of ShellCheck from github and install it.

1 Install ShellCheck

  • Install require packages of Fedora 34's ShellCheck package.
  • Download binary of ShellCheck from github.
#!/bin/sh -e

VERSION="stable"
URL="https://github.com/koalaman/shellcheck/releases/download"
URL="${URL}/${VERSION}/shellcheck-${VERSION}.linux.x86_64.tar.xz"

# Install requires package in order to Fedora 34.
sudo dnf install -y glibc gmp libffi

# Install ShellCheck.
wget -q -O - "${URL}" | tar -xJv
sudo cp "shellcheck-${VERSION}/shellcheck" /usr/local/bin/
rm -rf "shellcheck-${VERSION}"

2 Execution result

$ shellcheck --version
ShellCheck - shell script analysis tool
version: 0.7.2
license: GNU General Public License, version 3
website: https://www.shellcheck.net