3 ms·
As someone who is genuinely a fan of stupid pointless hacks, like Turing Completeness with CSS or Minecraft or whatnot, in my opinion this is definitely the stu
by jrm4 5y ago
As someone who is genuinely a fan of stupid pointless hacks, like Turing Completeness with CSS or Minecraft or whatnot, in my opinion this is definitely the stupidest. Kudos.
The entire point of Bash/Shell scripting is (or darn it, ought to be) to use it to string together OTHER programs to get stuff done. "Pure Bash" to me is like a bar of soap that never gets wet.
- jayceedenton 5y agoTo be fair, when writing scripts it's easy to fall foul of differences between GNU and BSD tools, or using an external tool that isn't available by default on some systems. Pure bash solutions avoid these problems, and can be just as simple as (or simpler than) an alternative that use external tools.
- wink 5y agoUntil you're happy you solved it in a nice way and then learn that your script will run on some ancient RHEL with bash 3 ;)
- xelxebar 5y ago> The entire point... https://en.wikipedia.org/wiki/The_purpose_of_a_system_is_what_it_does https://en.wikipedia.org/wiki/The_purpose_of_a_system_is_wha... Prescriptivism is perhaps helpful when starting out on a project and you need to prune down a vast tree of possibilities, but once you already have a thing, prescriptivist declarations are pretty impotent at helping you understand how that thing works. If your bash script has some tight loop, calling out to external tools can incur a huge performance overhead. Rewriting in bash can aleviate that. How do you re-write it in bash? Well... this article provides good fodder for thought! > like a bar of soap that never gets wet. Here are some uses of soap that would be hampered by it getting wet: - Make-shift lubricant on that sticky cabinet drawer - Draw temporary markings, like a crayon - Potpourri alternative - Fragrant seal on your letters - Deterrent to puppies chewing on your chair legs
- chasil 5y agoWindows is your foil. On the same hardware, Windows is 100x slower at forking an external process. When you are using a (POSIX) shell on Windows, don't cause a fork, especially in a loop. Do everything internally in a POSIX shell on Windows, unless an enormous time penalty is acceptable.
- jrm4 5y agoSure. I mean, I'm not being pure prescriptivist here; always good to explore and mess about with things. But if I'm getting a tad meta, I think there is generally enough of what you're doing (experts really hacking at things to push their limits) and not enough of what I think Bash/scripting could provide -- namely non-experts discovering "coding" NOT through the typical "start with a real language and do hello world" and instead through, "Here's bash; it's for stringing together other programs to do stuff."