3 ms·
I think this article is supposed to commend Python as a better choice than Bash? I think the author forgot to make a convincing argument for that, though. > Th
by softwarebeware 5y ago
I think this article is supposed to commend Python as a better choice than Bash? I think the author forgot to make a convincing argument for that, though.
> The point of bash-bashing is to reduce use of the shell.
That's a tautology. I get it, we're supposed to reduce the use of bash ... but why?
> Without much real work, it’s easy to replace shell scripts with Python code.
But you're writing the same thing again? There needs to be more reason than this.
> The revised code is easier to read and maintain, runs a little faster, and can have a proper unit test suite.
Three claims. Any data to support it?
Some of the examples of "bash is bad" are also not convincing to me. Here's an example:
> An example of a shell obscurity is the way the current working directory is set. The cd command is clear enough, but in the presence of sub-shells using (), can make it difficult to discern a stack of nested shell invocations and how the working directory changes when the sub-shells exit.
So...why do you have "a stack of nested shell invocations" that all need to be working directory aware? And how would this be any better in Python? (It could be better in either Python or Bash but either one still requires the developer to avoid simple mistakes.)
I don't know. I don't get it. I feel like the author had the unfortunate experience of knowing more Python than Bash and inheriting someone else's (who also didn't have much Bash experience) crappy Bash code.
- d0mine 5y agobash is anti-bicycle: no matter how long you use, it trips you up. https://www.oilshell.org/why.html https://www.oilshell.org/why.html Shell is great for one liners to run commands, cancerous for anything more complex. Fabric combines the best of both worlds: shell for one liners, Python for more complex logic https://docs.fabfile.org/en/2.6/getting-started.html#addendum-the-fab-command-line-tool https://docs.fabfile.org/en/2.6/getting-started.html#addendu...
- softwarebeware 5y agoIn my experience, it trips me up no more than Python or Fabric do. I have used Fabric a lot too. At another job, we built all of our pipeline tooling in it. I somehow keep returning to Bash, though. I enjoy it.
- deleted 5y ago[deleted]
- digisign 5y agoInteresting, I used fabric many years ago but thought it had been deprecated. However, it still seems remote focused. Is that a problem for a shell replacement?
- Nullabillity 5y agoAs far as I understand, Invoke is pretty much local Fabric. Or rather, Fabric is a networking layer on top of Invoke.
- digisign 5y agoThanks, looks like it has some similarities with make, however doesn't skip things already built.
- Syzygies 5y agoI've written extensive programs in Haskell, and yet I also have many Bash scripts. I go back and forth. For the longest time I ignored Perl and just wrote scripts in C. Then I learned Perl, then Python. I prefer Ruby for no better reason than it's less boring. These scripting languages share a common strength: nested hash tables make everything easier. Still, I'd revert to Bash, explaining that if you can't accomplish the same thing with virtual text files in Bash you don't really understand Bash. Nevertheless, switching from Bash to Ruby is like taking off a heavy backpack after a long day hiking. Who needs a joint when the weight is off your shoulders?
- drewcoo 5y agoAnd all this time I thought the common strength of "scripting languages" is that they're JITted. Otherwise they'd just be plain old compiled "languages."
- akhmatova 5y agoAny data to support it? There isn't any "data" on these things. It's a qualitative, holistic assessment of the risk-benefit tradeoff between two choices. Like much of life in general, in fact.