`shellcheck` - a shell script static analysis tool (update #1)

shellcheck - a shell script static analysis tool (update #1)

ubuntu 18.04 16.04 shellcheck bash atom

Considering today’s advent of CI and CD (Continuous Integration and Continuous Development), shell programming is still a thing and is still hard*1, but shellcheck is a tool that can save your life a lot of time.


sudo apt-get -y install shellcheck


I won’t write many more since there is a lot of documentation on the shellcheck’s homepage, but I will emphasize that shellcheck can be run in many editors, including vim, sublime text and atom, (here is the setup for atom on ubuntu).


Search the SCXXXX code in your favorite search engine, it will direct you to the shellcheck’s wiki with the full explanation and some advice for fixing the code. example:

test.sh sample file:

echo $0

shellcheck output:

shellcheck test.sh

In test.sh line 2:
echo $0
     ^-- SC2086: Double quote to prevent globbing and word splitting.

*1 As of today, there are more than 18’000 questions tagged bash on unix.stackexchange and stackoverflow.


Question, remark, bug? Don't hesitate to contact me or report a bug.