Bash is Dead

Written by: Kimberlee Model, posted: 2024-06-25. Tags: Computing Thoughts, Programming Language Development.

I'm killing off all my bash scripts because I'm fed up with its awkward syntax, questionable syntax, and general confusion. My go to replacements are python's subprocess, and Go's os/exec. Both are well documented, unreliant on hard to remember syntaxes, and integrate with general purpose languages which actually have workable list constructs.

The first use case I will talk about is replacing a benchmarking script which would call a python script to generate a test case, then call another program to run the integration test. Due to the inability of bash to pass lists around, it was getting obnoxious to pass around lists of arguments, so I replaced bash with a Python script which used subprocess to call the benchmark case generator, then the test program, regex search the output for time codes and other metrics, and put out a line of CSV for each benchmark case.

My colleague had spent about 5 hours trying to get the stupid bash script to work. I spent another 3 hours then gave up. The python was written and working in less than an hour.

The Go use case was to call program which generated JSON, then parse and use the JSON. Previously, a bash script would call the program generating JSON, which would write to a file. The it would do some other stuff, then call our Go program to read and process the JSON.

Now the go can use os/exec to call the JSON generator, and immediately capture the output into json.Unmarshal(). You might say that bash could pipe the JSON generator into my go code, but that wouldn't scale if we needed multiple JSON inputters.

Go read up on python subprocess and golang os/exec. Bash is DEAD.