logoalt Hacker News

iLoveOncalltoday at 12:10 PM2 repliesview on HN

Nice idea but I don't understand why people write bash scripts more than a few lines long.

There's absolutely 0 advantage, especially when AI can write simple code like that easily, over using any other language. It makes reading and maintaining much more complex.

Hell, even GitHub's syntax highlighting (and VS Code's) breaks in many places throughout the script. It's just a terrible developer experience, even for your own scripts that nobody else will ever touch.

Some people will say that the advantage is that you don't need to install another runtime, but even this is wrong as the script uses bash, not sh.

I hate Python with a passion, but I'd gladly take it over bash for any of those scripts.


Replies

jon-woodtoday at 12:26 PM

Bash is the wrong choice for truly complex software but I still find it really hard to pick anything else for the sort of tasks where I'm mostly manipulating text files and shelling out to other tools. My general instinct for when its time to reimplement a script in Python or similar is when I've got a ton of conditionals or function calls, at that point its also time to start writing unit tests.

shellcheck is a huge help in the middle sized shell script space and will regularly shout at me about missing all the random gotchas like not quoting file paths.

k3vinwtoday at 2:46 PM

> Nice idea but I don't understand why people write bash scripts more than a few lines long.

From a pragmatic perspective I agree. But I think you’re missing the point here. A lot of the most entertaining, and dare I say inspiring content, found on Hacker News is about exactly things like this. Things that seem silly, but are also very intentionally pushing the boundaries to the extreme/absurd.