░█░█░█░█░█▀█░▀█▀░░░█░█░█▀█░█▀▀░░░█░█░█▀▄░█▀█░█▀█░█▀▀
░█▄█░█▀█░█▀█░░█░░░░█▄█░█▀█░▀▀█░░░█▄█░█▀▄░█░█░█░█░█░█
░▀░▀░▀░▀░▀░▀░░▀░░░░▀░▀░▀░▀░▀▀▀░░░▀░▀░▀░▀░▀▀▀░▀░▀░▀▀▀

WWW in French

What Was Wrong

Other posts

================================================================

03 May 2021

shellcheck: check your bash scripts

If you're writing some bash codes for fun and you're not a professional then chances that your codes are working but crappy are quite high. Why am I making this statement without knowing you? Because that's my case and I wish to not be the only one bad programmer out there ^^

So, if you belong to this group you may like shellcheck. This program will (description from the official github):

shellcheck github

- point out and clarify typical beginner's syntax issues that cause a shell to give cryptic error messages

- point out and clarify typical intermediate level semantic problems that cause a shell to behave strangely and counter-intuitively

- point out subtle caveats, corner cases and pitfalls that may cause an advanced user's otherwise working script to fail under future circumstances

There is no excuse to not use it since it's available in:

- the terminal. Once the package installed, simply type "shellcheck your_script_name"

- vim through ALE, Neomake, or Syntastic

- emacs through Flycheck or Flymake

- sublime through SublimeLinter

- atom through Linter

- VSCode through vscode-shellcheck

And if you don't feel like installing one more package, this program is also offered as an online tool:

shellcheck online tool

Like some other underestimated tools, you don't think you may need them until you try then. After that, they simply become essential.

Using it you'll probably not become the best bash coder ever but you'll improve greatly. The simplicity of shellcheck makes it fun to use and a great way to learn better practices. When running it on your scripts, it'll show you where "errors" are, will offer some corrections, and provide an interactive link to a webpage which will explain what the error is and how to solve it. I highly encourage you to give it a try and you have nothing to loose if you do so with the online tool first.

If you need to be convinced of the utility of this program, you can also (shell)check this Youtube video from Distrotube:

distrotube's video

📬 contact me: wwwgem@disroot.org

🪧 gemini://www-gem.pollux.casa/system/04-shellcheckus.gmi