ShellCheck – Analyse, Show Suggestions and Warnings For Shell Scripts

Shell scripts are an important part of Linux systems. Most of the daily jobs and general jobs are done with shell scripts. The ShellCheck is a static analysis tool created to analyze the provided shellcode and give suggestions for better shell scripts and show warnings for some errors. The ShellCheck can be installed into all major Linux distributions where the installation is described below. The ShellCheck also provided as a web application which is also described below.

The ShellCheck is an open-source and active project which is developed via GitHub. The developed page can be accessed via . It is currently licensed with the GPLv3.

Install ShellCheck

ShellCheck can be installed for all major Linux distributions and even compiled from the source code.

Ubuntu, Debian, Mint, Kali:

$ sudo apt install shellcheck


$ sudo yum -y install epel-release
$ sudo yum install ShellCheck


$ sudo dnf install ShellCheck


$ sudo zypper in ShellCheck

MacOSX homebrew:

$ brew install shellcheck

MacOSX MacPorts

$ port install shellcheck

What Is Checked with ShellCheck?

The SchellCheck tool checks the following topics in general to provide suggestions and warnings.

  • Quoting
  • Conditionals
  • Misused Commands
  • Common Novice Mistakes
  • Style
  • Data and Typing Errors
  • Robustness
  • Portability
  • Miscellaneous

Check Shell Script with ShellCheck Command Line

After installation of ShellCheck, it can be used from the terminal or command line easily by just providing the shell script file. In the following example, we will check the shell script file named which is located under the /bin directory.

$ shellcheck /bin/

It works very fast where completed in a second even for larger script files. It outputs colored warnings and suggestions about the script file. First, the case line printed, and then suggestions and warnings are printed. The suggestions are printed as green and warnings are printed as orange. Also, line number information about the case is provided too.

Check Shell Script with ShellCheck Command Line

ShellCheck Web Application

ShellCheck also provided as a Web Application under the web address. Different from the command line version, this web application is developed with JavaScript. The shell script can be put into the online editor and it will be automatically analyzed and results will be printed under the page.

ShellCheck Web Application

The Apply fixes button can be used to apply suggestions and warnings into the shell script easily.

Apply Fixes and Suggestions To The Shell Script

Leave a Comment