Comment by nomel

2 days ago

Bash scripts requires "set -eu" at minimum, when written by LLM or human.

It's the only language terrible enough to make the default behavior ignore undefined variables, commands, and execution errors, and happily continue executing whatever was produced by me smashing my hands on the keyboard, until the end of the file, while returning an exit code of 0, claiming complete success.

“Only language” eh? I only have a passing familiarity or very distant memory so could be wrong but I’d say these are the same:

Perl (needs use strict)

Ancient VB/VBA/VB script

Original PHP (no idea about modern)

PowerShell

Old Windows/DOS batch

> Bash scripts requires "set -eu" at minimum, when written by LLM or human.

No. It does not. Just write good scripts and catch errors and handle them. That's the same more less with every language. And bash can be written in a way that it is sane and readable and maintainable. Just because you have seen a lot of junk in the language does not make the language bad per se. Sure there are a lot of languages "features" which are more then questionable but I want to rise again the point that it has its place and can be used in a good way.

  • I agree completely, if you use a linter like shellcheck [1]. If you're just winging it, then no.

    I first learned about shellcehck when I worked with someone that claimed they could write flawless bash scripts, then blamed me when their script broke because there was a space in a folder name. I ran his scripts through, resulting in him immediately adopting it, while he enjoyed eating crow.

    [1] https://www.shellcheck.net

    • Yes :) I'm using shellcheck since at least 2012/2014. And I loved the bash haters handbook <3 in all seriousness, bash will shine then when you have no heavy tooling available and we still have these systems around as at least at some point in time in their life time. With most stuff in life: you should take care and pay attention

      1 reply →