With the exception of my “draft” script, I’ve moved all my shell scripts for this site into a Makefile. Originally, I used gulp-shell, but was quickly reminded of the sheer number of packages you need to do even the simplest operations in Node. At that point, I decided to find an alternative solution.
Although I hadn’t used it before, I found the process to be pretty smooth - aided by this Hacker News comment where I asked a question about it. In simple terms, a Makefile typically contains a set of “rules” in a particular format and Bash commands can map to each of them. These rules perform actions on files or directories (a.k.a, their “targets”).
Converting the “draft” script will take a bit longer, as it’s made up of multiple lines and has variables, redirection, and a sprinkling of AWK all thrown together. Most of the examples I’ve found are far simpler, which is helpful, but they are usually written with a language like C++ in mind. As a result, I’m kind of in the dark about how all of the pieces fit together.
In short, it’s the one drawback of being something of an accidental programmer. I suspect there’s more to write on this particular topic, but that’s an exercise I’ll save for another day.