4 ms·
Why are we still using this in 2020?
by jblow 7y ago
Why are we still using this in 2020?
- bori5 7y agobash is ubiquitous, and for me who grew up pre-python, which I probably should start learning for bash like tasks.
- jblow 7y agoToxic waste sites were ubiquitous too, but we put in the effort to clean them up.
- grayed-down 7y agoI'm game. What's your plan?
- DonHopkins 7y agoThis applies to bash as much as to X11 ICCCM: https://medium.com/@donhopkins/the-x-windows-disaster-128d398ebd47 https://medium.com/@donhopkins/the-x-windows-disaster-128d39... In summary, ICCCM is a technological disaster: a toxic waste dump of broken protocols, backward compatibility nightmares, complex nonsolutions to obsolete nonproblems, a twisted mass of scabs and scar tissue intended to cover up the moral and intellectual depravity of the industry’s standard naked emperor. Using these toolkits is like trying to make a bookshelf out of mashed potatoes. - Jamie Zawinski X-Windows: …Even your dog won’t like it. X-Windows: …The first fully modular software disaster.
- yjftsjthsd-h 7y agoBecause nobody has written a good (universal) alternative. POSIX sh is available everywhere and is extremely well suited to gluing things together.
- HorstG 7y agoIf you need a portable replacement, there is Perl. Available since the last century. If you don't care about obscure Unixes, there is also Python and a whole bunch of other scripting languages on more modern systems.
- baby 7y agoIt never matters in practice, just bootstrap your environment by installing python and use a python script.
- peterwwillis 7y agoWhat do you bootstrap the python environment with?
- jblow 7y agoObviously, but then the answer is, why? What the hell is our problem? Even if you think shell scripting is a good idea (which I don’t), just fix all the obviously dumb toxic stuff like this and put out a shell that is minimally different with only semantic fixes. Emit warnings now for toxic semantics but still support them, and in a couple of years, turn off that support for good.
- shuspect 7y agoJust do it.
- sullyj3 7y agoI feel like "busy working on a different programming language" is one of the better excuses for not doing this.
- gpvos 7y ago> in a couple of years, turn off that support for good. Make that at least 50 years, if not 100. You have no control over every place where shell scripts are run.
- peterwwillis 7y agoI think the problem is the people who don't understand the difference between "obviously dumb toxic stuff" and "features". This thread is all about the difference between $* and $@. The difference is explained in the man pages for most shells, but since most programmers don't read instructions, they often need blog posts to explain to them how a documented feature of a language works. I highly recommend the dash man page (http://man7.org/linux/man-pages/man1/dash.1.html http://man7.org/linux/man-pages/man1/dash.1.html) as a concise explanation of portable shell syntax. From the dash man page, under Special Parameters: * Expands to the positional parameters, starting from one. When the expansion occurs within a double-quoted string it expands to a single field with the value of each parameter separated by the first character of the IFS variable, or by a ⟨space⟩ if IFS is unset. @ Expands to the positional parameters, starting from one. When the expansion occurs within double-quotes, each posi‐ tional parameter expands as a separate argument. If there are no positional parameters, the expansion of @ generates zero arguments, even when @ is double-quoted. What this basically means, for example, is if $1 is “abc” and $2 is “def ghi”, then "$@" expands to the two arguments: "abc" "def ghi" It turns out we didn't need a blog post to explain it, because it's in the manual that nobody reads. But we should definitely complain about how this crafty, unusual piece of obviously dumb toxic stuff works, because how were you supposed to know to RTFM? To answer your question "why still in 2020?", it's because these are independent features people needed. Sometimes people wanted the $* semantics, and sometimes the $@ semantics. So both exist. It's up to you to learn how the system works and use it properly. It's not like Python doesn't also have weird edge cases that you won't know until you learn the whole language. I've seen people spend hours futzing about with lambdas and list comprehensions to try to fix a bug, which I addressed by just rewriting the expressions as regular-old loops and data structures. Bash isn't uniquely bad, it has warts like everything else. Take out the warts you don't want and someone else will complain that they're missing.
- pkrumins 7y agoWhy wouldn't we use it? It's so effective at getting Unix tasks done. I'll be writing more bash than ever in this decade.
- DonHopkins 7y agoYou could also ask why are we still using X11 in 2020? Same tragic embarrassing reason.