Tips

Install ShellCheck So That You Can Use It Locally

If you’ve been writing shell scripts, or if you’re new to writing scripts, you may not know of ShellCheck – and you that can install ShellCheck for use locally. This means you don’t need to go online to check  your shell scripts, saving you time and effort – as well as being available offline.

If you don’t already know of ShellCheck, march your ass over there right this minute! It’s one of the greatest tools on the internet. If you’ve already read the whole linked page, you can pretty much skip this entire article! After all, it tells you how to install ShellCheck over there – and I’ll be duplicating a lot of that here.

Why am I duplicating it? Because so few people seem aware of it. So few people know this tool exists, even for online use. Time and time again, I see scripting questions that can be debugged/resolved using this wonderful ShellCheck tool.

So, like many of the articles on this site, it’s here so that we can link to this article and not have to repeat ourselves time and time again. Like much of the site, it’s meant to save time and to avoid duplicating effort!

There are other ways to use ShellCheck, such as directly in your editor. This article will not be covering those other ways, I’m simply going to tell you how to install it and use it from your terminal.

Install ShellCheck For Local Use:

Like so many of these things, you need to start with an open terminal. To do so, use your keyboard – just press CTRL + ALT + T and your default terminal should open. If it doesn’t, just open it from your application menu.

Once you have the terminal open, you can install ShellCheck. It’s available in most default repositories, so you shouldn’t have any issues installing it.

Debian/Ubuntu:

sudo apt install shellcheck

Arch/Manjaro:

pacman -S shellcheck

Fedora:

dnf install ShellCheck

OpenSUSE:

dnf install ShellCheck

One of those ought to work. If not, follow the link in the second paragraph, poke around, and you’ll see that you can likely get ShellCheck installed with little or no difficulty. Worst case, you can grab the binaries and install it manually.

Using ShellCheck is even easier. You just use ‘shellcheck’ and then the path to the script. So, it’d look something like one of the following:

shellcheck ~/Documents/script.sh
shellcheck /path/to/script
shellcheck ../path/to/script

It’s really that easy. ShellCheck isn’t perfect and it doesn’t recognize every error, but it’ll catch a ton of beginner mistakes and typos. It’ll catch syntax issues and punctuation mistakes. It’s pretty handy and is absolutely a great tool for anyone that does any scripting at all.

Closure:

And there’s another article! This one will help you install ShellCheck, a fantastic tool for people who need to check their scripts. It’s right there in the application’s title! Really, more people need to be aware that it exists, and hopefully this article does a little something to help raise awareness.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

KGIII

Retired mathematician, residing in the mountains of Maine. I may be old and wise, but I am not infallible. Please point out any errors. And, as always, thanks again for reading.

Recent Posts

Enable/Disable Your Network Interface

Today we'll cover one way to enable or disable your network interface in the Linux…

6 months ago

Check Your NIC Speed In The Terminal

Today's exercise is a nice and simple exercise where we check your NIC speed in…

6 months ago

Easily Monitor Your Wireless Connection

Have you ever wanted to easily monitor your wireless connection? Well, now you can learn…

6 months ago

Count The Files In A Directory

I think I've covered this before with the ls command but this time we'll count…

6 months ago

Get System Information With The ‘uname’ Command In Linux

Today we'll be learning about a basic Linux command that's known as 'uname' and it…

6 months ago

hardinfo Has Been Rebooted As hardinfo2

If you've used hardinfo in the past, it may interest you to know that hardinfo…

6 months ago