Tag shell

 Bookmark

I used to write a lot of shell scripts before realising that what I was trying to do was treat shell scripting as a "full" scripting language (I won't define here what I mean by "full").

Its not - reach for a higher level scripting language like Ruby or Python when things are getting more complicated, and allow shell scripts to glue things together, or be for quick tasks maybe a few lines long.

When you do write them, this advice is great but it's definitely worth gaining understanding of when you should and shouldn't use them.

 Bookmark

In every programming language, there is a linting tool that can help pick up on some common style issues. ShellCheck isn't one of those - it's so much more!

I've been using it for many years now, and since it came into my life it's honestly changed the way I use shell scripts. There have been so many pitfalls that I've avoided falling into since learning about them (and adding ShellCheck to my Vim linting setup.

This is a great read from Vidar, the ShellCheck author, about a case where it could've caught issues that caused the deletion of a production database!