HN Hall of Fame Weekly email

How to write idempotent Bash scripts

arslan.io Books & learning Tutorials & guides Software engineering Candidate
Screenshot of arslan.io captured 2026-07-20
Page preview · captured 2026-07-20

Resurfaced independently across 3 calendar years, with breakout response in 2 of them.

submissions
3
submitters
2
observed span
2019–2023
peak thread · 189 comments
655 pts
latest 20+ return · 2021-12-08
330 pts

Submission timeline

2007–2026

One slot for every year since HN launched. Height is that year's peak points; orange marks a 100+ point or 50+ comment breakout. Select a bar to open its strongest thread.

First comments on top threads

HN comment order

It’s good to know which command line tools are idempotent, but I think once you start running automated scripts repeatedly you’re better off with something like Chef where you declaratively define the end state and let chef figure out how to converge upon that state. Taking the “create a directory” example, you would say “I want to end up in a state where this directory is created and has these permissions” and chef will determine if the directory already exists…

mnutt·655-point thread·

Idempotence is achievable elegantly with makesure tool [1] using @reached_if directive [2]. Full disclosure - I’m the author of the tool. [1] https://github.com/xonixx/makesure [2] https://github.com/xonixx/makesure#reached_if

xonix·330-point thread·

The first top-level comment from each of the four biggest threads, in HN’s own order. Excerpts are shortened; open a comment for full context.

Breakout years
2

100+ points or 50+ comments

Total points
988

reference only — not used in Hall rules or ranking

Total comments
290

reference only — not used in Hall rules or ranking

Every submission

DateTitle as submittedByPointsComments
2019-07-07How to write idempotent Bash scriptsFirst breakout · Best threadkiyanwang655189
2021-12-08How to write idempotent Bash scripts (2019)Latest 20+ point returngautamsomani330101
2023-07-05How to write IdemPotent Bash Scripts (2019)gautamsomani30