3 ms·
They are fast, ubiquitous, 0-dependencies, short, espressive... most of the time. The fact is that we don't have anything better to glue commands together (afai
by riquito 9y ago
They are fast, ubiquitous, 0-dependencies, short, espressive... most of the time. The fact is that we don't have anything better to glue commands together (afaik).
- virtualized 9y ago"Glueing commands together" is called programming. That's what programming languages are for. Bash etc are just really bad programming languages that lure you into a trap of unnecessary complexity with their superstitial expressiveness for the happy path in short programs, when you don't need anything besides the built-ins. Decades of ubiquitous UNIX crap tricked you into believing that bash's properties are advantages rather that disadvantages. Sure, you can "glue together" a few commands quickly, but only at the price of horrible edge cases and hours of StackOverflowing for doing the simplest of things.
- logicallee 9y ago>but only at the price of horrible edge cases and hours of StackOverflowing for doing the simplest of things. Or seconds, after you learn the search term "Perl one-liner" and add it to your queries for all your edge cases. Start thinking of perl -we as a Bash built-in function. Suddenly edge cases go from hours to your typing speed into Google. Don't forget to leave a comment with a link to where you found the solution, what it does according to that site, and an apology for the unreadable line noise. If you make changes to what you copy and paste, explain your changes in a comment. (Just in case it sounds sarcastic or ironical, this comment is serious and how I really work. I am really glad for my comments whenever I revisit old scripts.)
- Slackwise 9y ago> 0-dependencies Actually, quite the opposite. All that shell scripts do is glue together other programs they depend on. That makes them not portable. You can't just move a bash script from Linux to macOS because it uses ancient pre-GPLv3 versions of bash and all the other GNU utils.
- jstimpfle 9y agoJust use POSIX-compatible sh instead of bash. It's also not hard to use mostly POSIX-compatible commands (grep, sed, cat, cp, mkdir ...). For scripts where you need something unstandardized, say, imagemagick, you would wind up with up with a dependency in most other languages as well.