Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Bash has a thousand pitfalls, and as you accumulate layers of scripting they start compounding. Little things like “what the hell directory is this command actually running from”, parsing input parameters, quoting rules, exit statuses, pipelining, etc.

Tools like just provide a very consistent and simple base to start with, and you can always still call a separate script, or drop directly into inline shell scripting.



So it's not a fundamentally different use-case, it's just an admission that shell scripts suck at what they do?


Of course. Is that news to you? Not a snark, I am genuinely surprised, assuming that you asked seriously.

I moved to ZSH some years ago but even that is not good enough. I thought of using Fish at one point but just said "frak this" and started writing Golang for anything that's more than 20-30 lines of bash/zsh scripting. Or requires their weird list / array syntaxes for iterating over stuff. Can't ever remember that with a gun to my head.


Shell scripts can be used safely if you know how to. Have solid error handling, exit on error (set -e), write tests (BATS) and a few other things to make sure it doesn't break. You are not gonna get the same performance with just or whatever new tooling there is just to run commands on your system


> Shell scripts can be used safely if you know how to

That's the contention point though -- I learned and relearned shell scripting no less than 7 separate times and it always slips away because it's not something I practice every day. Ultimately I concluded it's not worth it because you mostly have to memorize super weird syntax and strange exceptions to rules. At one point I was just like "screw this" and went for Golang.

> You are not gonna get the same performance with just or whatever new tooling there is just to run commands on your system

That's very debatable, I'd bet my Go programs process various things either faster or with the same speed. But even if they are slower that's often not important because most scripts I ever wrote were throwaway. Those that stuck around I have polished and re-polished, including with the measures you enumerated.


> if you know how to

That’s a big if. I worked on a shell based tool for a couple years and eventually accumulated the know-how and toolset to write reliable code; but nobody else could contribute as the learning curve was too great.

I switched to Ruby for all new tools and never looked back. Performance is rarely a concern in this territory, and you can always offload heavy work to another process.


Performance in your shell script is a new one. Can you cite a real world example where that would ever matter? My shell scripts just initiate build/export/deploy programs. They take milliseconds to run and then the programs they start take minutes. The perf of those milliseconds couldn't be more negligible.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: