Post #2383499
2026-04-30 03:44 UTC
This isn't "the one true way to write bash scripts" or anything, it's just table stakes - a common progression that helps clarify intent and design early, at the point when a script might *just* be useful enough that the implementer then moves on to higher priority tasks and doesn't look at the script again for nine years.
(There are more steps later of course, like consistent error checking & handling, logging with priority levels & verbosity control, and of course shellcheck(1). Later.)
2/2
Replies (2)
-
@monospace@floss.social 2026-04-30 07:51
@gnomon@mastodon.social Those are all good practices. I need to make myself a ready-to-use script template. All I'd add is "Know when to switch to a proper programming language." There are too many bash monstrosities in the world already.
-
@cks@mastodon.social 2026-04-30 19:53
@gnomon@mastodon.social I keep wishing Bash had added a "getopts_long" builtin so my shell scripts could support long options. It feels so wrong that none of my shell scripts have them. (AFAIK you really need to do this with a builtin, not an external program, or you wind up in quoting hell.)