Skip to content
Nikita Aull Nikita Aull

bash Idioms - Carl Albing, JP Vossen

2 min read 276 words

Nasty weather all weekend, so here’s the second book of the week :)

My colleague and I often argue about readability, cleanliness, and expressiveness of code. I write code so that even without knowing the language, but knowing English, a person could read and understand what I meant. My colleague calls this dirty, verbose, inexpressive code. Yet when he writes something in Python or bash, I can’t even parse a code block without an explanatory brigade.

He uses every convention and every method of language expressiveness, generalizes and cleans up code to achieve perfectly pure functions.

And this “cleanest code” is then impossible not just to maintain - but even to read.

I don’t spare words, lines, and characters, the main thing is that later this code can be understood and easily maintained.

So this book is about brevity, cleanliness, and expressiveness of code written in bash :)

The author shows very expressive, concise, and what he considers “easily readable” ways of writing well-known bash constructs.

I disagree with many idioms, as I don’t like the approach of compressing 4-5 lines of clear code into one line of concise but hard-to-read notation.

But I still liked the book. The author explains all these idioms in clear language. Provides understandable examples.

I also liked that the author as an entity is absent from the book, except for the preface - he doesn’t remind you of himself every page.

And overall the advice is quite sound:

  • write understandable code,
  • write easily readable code,
  • add comments,
  • maintain documentation

It’s just that everyone interprets these truisms differently :)

Definitely recommend.

bash Idioms: Timeless Shell Script Patterns Carl Albing, JP Vossen

bash Idioms