← Notes

Why we still write shell scripts

2026-08-02 · 5 min read

There is a genre of engineering writing that treats bash as a phase you grow out of, like a band you liked at seventeen. The implication is that serious systems are written in serious languages, and shell is what you use before you know better.

We write a lot of shell. Not because we are nostalgic, but because a surprising share of the work is gluing two things together that were never designed to meet, and shell is the shortest path between them.

What shell is genuinely good at

  • Process orchestration: start, wait, check, kill. Nothing else expresses this as directly.
  • Text as an interface. If every tool on the box speaks lines, a pipeline is a data structure.
  • Being present. It is already installed, it is already in the image, and it does not need a build step at 4am.
  • Failure that is loud. set -euo pipefail is four words and it removes a whole class of silence.

What it is bad at, and we do not pretend otherwise

Anything involving structured data. The moment you find yourself parsing JSON with sed, stop and reach for jq. The moment you find yourself writing a function with more than three arguments, stop and write it in Python. The moment you want a data structure that is not "a string" or "a file", you have left the language's design envelope.

The failure mode is not that shell is weak. It is that shell is permissive: it will let you build the wrong thing and it will almost work.

The rules we actually follow

  1. set -euo pipefail on line two, always, no exceptions.
  2. Every script starts with a comment block: what it does, what it needs, what it changes.
  3. No script over 150 lines. Past that it becomes a program and deserves a program's tooling.
  4. Anything that touches money or deletes data gets a dry-run flag, and we use it.
  5. Quote every variable. Then quote it again in your head.

None of this is novel. It is just the difference between a script that survives three years of being edited by people who have never read it, and one that becomes folklore.