8 ms·
> Bash is riddled with absurd footguns I agree, shell programming is ugly and very unsafe. > Anything more complex than that? Python, Perl, or any other prope
by ur-whale 3y ago
> Bash is riddled with absurd footguns
I agree, shell programming is ugly and very unsafe.
> Anything more complex than that? Python, Perl, or any other proper programming language is there for you.
I disagree.
First, there are certain things, specifically when you want to process very large datasets that are easiest - by a very large margin - to build using shell scripts: a combination a ripgrep, sed, awk, grep, cut, tr, paste, jq, head, tail, etc ... is way easier and faster to put together in bash than anything else.
Second, to get maximum flexibility you'd like to be able to switch from one (python, perl) to the other (shell script) transparently and both ways
Do certain things that can be expressed cleanly in python, and then transparently switch to bash calling a horde of specialized shell commands when the task at hand is easier to express that way.
Shell can transparently go down to Python or Perl very, very easily.
Unfortunately, the converse is absolutely not true: while Perl can - to a certain extent - be used to construct complex pipelines of data processing external commands, it is nowhere near Shell in ease of use.
And it is a giant PITA in Python which gives you fuck-all above exec/fork level subprocess manipulation: writing large external pipelines in Python is about as easy as it is in C.
- 0xbadcafebee 3y ago> > Bash is riddled with absurd footguns > I agree, shell programming is ugly and very unsafe. Sharp knives are "unsafe". Kids shouldn't use them. Professionals prefer them. I find most 'footguns' to be normal expected behavior, and the user shot themselves in the foot because they're careless or ignorant.
- BossingAround 3y agoThere's a difference between using a sharp knife, and a hammer that has been sharpened on one side so that it's usable as a knife, and pointy on another side so that it can be used as a weapon in case of a home intrusion, while keeping one side as an actual hammer and the handle is covered in honey for more friction in case your hands get sweaty. Both can be unsafe, but one is a professional tool while the other is an abomination for our current standards.