Don't be a Bash BRAINLET!


In a new vid, I talk about the importance of good design, and what that means in your typical shell script. I take the example of the shortcut-sync script I use to keep my bash, ranger and qutebrowser aliases synced and autogenerated. Originally when I wrote it, it was terribly designed, looping through a file and outputting to files six different times per line, adding up for a staggeringly long 1.5 second runtime for a 45 line script! The newer, better version (see the above link to Github), uses streams in the proper way to produce nearly instantaneous completion.

It's a pretty good example of how good (or bad) design principles can add up hugely on a system. It's almost mind-boggling to think about the difference that well-written and efficient code can make even for typical users as you add up the hundres of thousand or millions of lines of code we end up running every day.

A lot of people will repeat the typical mantra that we "need more programmers" for the modern economy. I have to say I've always hugely disagreed with this. A lot of the effort spent in the industry is maintaining the unmaintainable and playing whack-a-mole with the problems that bad design creates. We'd be better off with a smaller contingency of programmers and tweakers mindful of efficiency and machine resources. This is definitely something I've realized directly while I've started using UNIX operating systems.