6 ms·
> Do not write scripts with bash. It's a bit too late for that. Bash is pretty much the de facto default shell for linux. Telling people not to use bash script
by thankthunk 8y ago
> Do not write scripts with bash.
It's a bit too late for that. Bash is pretty much the de facto default shell for linux. Telling people not to use bash scripts is like telling web devs not to use javascript or OS devs not to use C.
It may change in the future, but bash is so entrenched, it's going to take an extraordinary use case for people to move from bash.
- Sir_Cmpwn 8y ago>Telling people not to use bash scripts is like telling web devs not to use javascript or OS devs not to use C. Wow, this comparison is totally whack. Javascript and C are both standardized and the former is the only option when using a web browser. It's never too late. We managed to get people off of ANSI C and there's a similar amount of difference between ANSI* C and C89 as there is between bash and sh. * correction: pre-ANSI
- thankthunk 8y ago> Wow, this comparison is totally whack Did you really say whack? > Javascript and C are both standardized and the former is the only option when using a web browser. Javascript isn't the only option. It is the most popular by far and hence the "de facto" language of the web. And javascript certainly isn't "standardized" in the sense you are writing. Do you know anything about web development, browser implementation of javascript and javascript itself? Javascript is no more "standardized" than SQL is standardized. Every RDBMs implements their own flavor of SQL just like browsers do with javascript. >It's never too late. Did I say it was too late? Of course I didn't. Maybe if you took a step back from your fanboyism and read... "It may change in the future, but bash is so entrenched, it's going to take an extraordinary use case for people to move from bash." > We managed to get people off of ANSI C and there's a similar amount of difference between ANSI C and C89 as there is between bash and sh. ANSI C and C89 are the same thing. ANSI C is just another name for C89... Sigh...
- Sir_Cmpwn 8y ago>Javascript isn't the only option. It is the most popular by far and hence the "de facto" language of the web. And javascript certainly isn't "standardized" in the sense you are writing. Do you know anything about web development, browser implementation of javascript and javascript itself? Javascript is no more "standardized" than SQL is standardized. Every RDBMs implements their own flavor of SQL just like browsers do with javascript. This is nonsense. I am very familiar with web browsers. Javascript is standardized as ECMAScript: https://www.ecma-international.org/publications/standards/Ecma-262.htm https://www.ecma-international.org/publications/standards/Ec... The "standard library" browsers implement is also standardized: https://www.w3.org/standards/ https://www.w3.org/standards/ You're off your rocker. >Did I say it was too late? Of course I didn't. Maybe if you took a step back from your fanboyism and read... Here is a direct quote from your comment: >It's a bit too late for that. Bash is pretty much the de facto default shell for linux. >ANSI C and C89 are the same thing. ANSI C is just another name for C89... Sigh... Derp, I meant K&R C or pre-ANSI C. My mistake.
- thankthunk 8y ago> This is nonsense. I am very familiar with web browsers. Javascript is standardized as ECMAScript: As I said, it is standardized as SQL is "standardized", but every browser implements their own flavor just like every database server. You aren't familiar with anything. That much is obvious. > You're off your rocker. It's funny how my comments are flagged but not yours when you've been spouting nonsense. > Here is a direct quote from your comment: That's right. It's a bit late to tell users to stop using bash. What's so confusing about that? My point is that a "strong use case" has to be introduced, not telling people to switch? Once again, if you learned to read rather than fanboying, you would have caught onto it. My point is that telling people to change isn't going to work when something is established. There has to be a serious use case to incentivize people to switch. Okay? No different than switching to powershell from cmd in windows or to python from perl in linux. >Derp, I meant K&R C or pre-ANSI C. My mistake. "Derp"? All your comments were "derp". But this being Hacker news, people providing factual and thorough responses get penalized why people spouting nonsense like "that is whack or "you're off your rocker" doesn't. Maybe you should learn about C, Javascript, web development, browsers, internet or anything before spouting nonsense. Okay? And maybe you learned to read rather than jumping to conclusions. Because every single response of yours has been a result of you misreading my comment. Good day.
- moviuro 8y agobash is completely out of date on macOS (GPL2 vs. GPL3), and not shipped on any *BSD AFAICT. Some Linux distro don't ship it either (void, alpine IIRC). And, most of the time, bash is used because people don't know any better, see e.g. https://github.com/OpenRA/OpenRA/pull/8405/files https://github.com/OpenRA/OpenRA/pull/8405/files
- falsedan 8y ago> bash is completely out of date on macOS I love finding and removing all the GNU/Linux-ism in my bash code when I move it from a dev host to my personal laptop. macOS coreutils don't have GNU longopts, surprise!
- umanwizard 8y agoIn case you didn't know: if you really need some GNU tool, you can do `brew install coreutils` (assuming you use Homebrew). The installed binaries will have their names prefixed with `g`; e.g. `gdate` instead of `date`. If something you want isn't part of coreutils, you can often install it directly; e.g. `brew install gawk` or the weirdly-named `brew install gnu-sed` (which names its installed binary `gsed`... go figure.)
- falsedan 8y agoI know this; but can I teach every potential user of my scripts this same fact through documentation I have to maintain? What if: I write the code so that documenting it is easier?
- orzen 8y agoBash is nowhere close for being de facto default shell for Linux. This is a bad analogy. In this case it is more like telling people that want to code Javascript to only write it in React. You got to go from something generic to something specific. Scripts written with bash will often rely on bash-specifics and can therefore only be interpreted by bash. There are entire projects dedicated to stop this plague. If you want to write portable shell scripts, use dash. https://linux.die.net/man/1/checkbashisms https://linux.die.net/man/1/checkbashisms https://mywiki.wooledge.org/Bashism https://mywiki.wooledge.org/Bashism https://wiki.ubuntu.com/DashAsBinSh https://wiki.ubuntu.com/DashAsBinSh https://en.wiktionary.org/wiki/bashism https://en.wiktionary.org/wiki/bashism
- raarts 8y ago> Bash is nowhere close for being de facto default shell for Linux. Oh, yes it is. Every important distribution uses bash as the default.
- umanwizard 8y agoUbuntu has dash as /bin/sh.
- deleted 8y ago[deleted]
- JdeBP 8y ago> It may change in the future, but bash is so entrenched, it's going to take an extraordinary use case for people to move from bash. You don't know your history. Exactly such a move has already happened once, a decade ago. And it was a success. * https://lists.debian.org/debian-release/2007/07/msg00027.html https://lists.debian.org/debian-release/2007/07/msg00027.htm... * http://initscripts-ng.alioth.debian.org/soc2006-bootsystem/bootcharts.html http://initscripts-ng.alioth.debian.org/soc2006-bootsystem/b... * https://wiki.debian.org/BootProcessSpeedup#Using_a_faster_system_shell https://wiki.debian.org/BootProcessSpeedup#Using_a_faster_sy...
- gkya 8y agoQuite some people use Zsh interactively.