Check your scripts with ShellCheck

I just learned about a great tool called ShellCheck (https://www.shellcheck.net/). This is a great tool for checking your bash scripts for errors and getting rid of bad code.

If you’re on Ubuntu, do a:

$ sudo apt install shellcheck

and check your script with:

$ shellcheck script.sh
1 Like

That’s a really great tool. I use it with Visual Studio Code and the Remote Extension. I connect to the Ubuntu Server from VS Code via SSH and the ShellCheck results are directly shown in VS Code. ShellCheck is even executed remote on the Ubuntu Server.
All tools are free and Open-Source.
The provided apt package is outdated by the way. However there is a good explanation how to compile the latest ShellCheck version.

MatzIT,

Thanks for the tip. Maybe I’ll have a go at compiling it myself.