10 ms·
Bash 5.1
- LeoPanthera 6y agoI know that zsh is the hot new thing, but I've been using bash for about 30 years, and at this point, sheer inertia means it's unlikely I'll ever switch away. Long may it continue.
- chungy 6y agozsh started in 1990... it's not that much younger than bash (1989).
- holistio 6y agoit's the _hot new thing_, don't ruin the party
- coldtea 6y agoIt's not new. If anything, it's as old as bash (~ 3 decades). And there's no particular glory in sticking with some older shell, else we'd still be using csh or sh.
- pmarin 6y agoI still use csh, the original one without line editing. I find faster most of the time to perform string substitution over the history. There is no glory, it’s the use of the same tool every day for 20 years.
- spijdar 6y agoTo add to this, zsh was present on NeXTSTEP (OS X's technological predecessor) in the early 90s, before bash was added. bash wasn't actually present in mac OS X 10.0 AFAIK, it was added later. So zsh has just outlasted it.
- TylerE 6y agoEarly OS X was csh I think. It was definitely something weird and antiquated.
- sleepy_keita 6y agoThrough 10.2.x it was tcsh, then switching to bash in 10.3? I think?
- KMag 6y agoI'm trying to remember why I was dealing with csh/tcsh so much on MIT's Athena in the late 1990s. Perhaps tcsh was the default shell there (or maybe just on the Solaris or IRIX workstations). Maybe some old-timer convinced me early on to change my default to tcsh. In any case, csh and tcsh have some painful corner-case behaviors [0] [0] http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/ http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/
- kkylin 6y agoThat's my memory of Athena from those days as well, though I cannot say why that was. Definitely agree with csh and tcsh being painful. But being the first shell I got to know, I still know it well and better than the alternatives...
- watersb 6y agoBSD default shell was csh in late 80s into at least 1990. Switched to tcsh for the readline editing and history search.
- usr1106 6y agoSame here, tcsh was the thing in the 1990s. I would have claimed bash came only with Linux. That's not true. But it was not very known at the days. I guess only Linux changed that, using it as default shell in many distros. tcsh had the reputation of being more usable than Bourne shell. (The quirks related to programming meant the cautious people used it only interactively.) So Bourne again did never sound like good marketing to me. It took me years to try it even after the years I had not even heard about it.
- stoolpigeon 6y agoIs the "hot new thing" status of zsh due to the macos change or is there more going on with other platforms? I've used both and maybe it's because I'm just not doing anything beyond normal, basic stuff - but I don't see a big difference.
- tutfbhuf 6y agoI use zsh for interactive shells and bash for scripts.
- pfranz 6y agoI remember it getting popular years before macOS switched. I believe Oh My Zsh (a zsh framework) being popular when I first tested it out and that looks to be 10 years old. The things that got me to try it was being mostly compatible with Bash and having a lot of features that Bash only got later. I remember liking recursive globs, which look like they got added to Bash 4, but my OS may not have had it at the time.
- oblio 6y agoZsh has had more features than bash for decades. If anything, bash has caught up recently. It's just Apple using zsh as a default shell. People tend to use defaults and a lot more people are exposed to zsh now.
- raverbashing 6y agoThe problem with ootb zsh is that it's weird. Even PS1 is not friendly Then you start to feel insecure thinking it might be too weird and don't try it
- coldtea 6y ago>Then you start to feel insecure thinking it might be too weird and don't try it Me (using fish): Hmmmmmm....
- mattgreenrocks 6y agoYeah. I've gotten to the point where I hate tweaking things, and zsh feels like a pit of endless tweaks. I'm sure I could go dig up someone's package that has sane defaults, but, I ultimately don't care enough to do the work to vet _that_ configuration. Hence, I'm on fish.
- faizmokhtar 6y agoI thought fish is the hot new thing
- yukinon 6y agoI've been using fish for the past few months and the jury is still out. On one hand, the out of the box behavior and configurability is fantastic, and by default it is very pleasing to the eyes. On the other hand, on my macOS there was a noticeable lag after I hit enter on a command that is not in bash. I also have very little attention span for figuring out fish's unique function loading system to pimp my shell like I would bash.
- rgoulter 6y agoFor customising the prompt, starship.rs is excellent.
- watersb 6y agoAnd is my default prompt for PowerShell on Windows 10!
- gabagool 6y agoI think fish is great for newcomers or for those who don't really want to mess around with too many settings or plugins. I'm a fish user, actually. That said, for those on zsh who want some of fish's most prominent user features without leaving, check out zsh-syntax-highlighting[1] and zsh-autosuggestions[2]. These are rather popular so long time users may not benefit from these suggestions. [1] https://github.com/zsh-users/zsh-syntax-highlighting https://github.com/zsh-users/zsh-syntax-highlighting [2] https://github.com/zsh-users/zsh-autosuggestions https://github.com/zsh-users/zsh-autosuggestions
- dEnigma 6y agoInteresting. I also used fish for a while after looking at bash alternatives, but ended up with zsh, because fish had some (admittedly minor) inconveniences/bugs, and zsh felt more mature. But very soon I had to install the two extensions you mentioned because my shell felt really incomplete without them after fish.
- krab 6y agoI find zsh mostly compatible (at the level I use shells). When developing scripts, I use the bash shebang, but I'm trying individual parts in my interactive shell. It's quite rare that I need to start bash. Often, zsh works the same.
- j7ake 6y agoMy problem with other bash alternatives like zsh or fish is that it develops habits that don’t translate across servers that might only have bash. I prefer using bash in this case because it means my bash scripts are more portable across different systems.
- opan 6y agoI use zsh, and any scripts I make just use plain sh.
- dastx 6y agoI think this is key. In my dot files, I take advantage of all the zsh features if I need to. But when I write a script that's meant to be executed rather than sourced, I aim to use posix wherever possible, and fall back to bash if it's not.
- signal11 6y agoI wonder if POSIX/sh is really necessary if you're targeting Linux. I mean, if you're targeting multiple Unixes, sure, but a lot of my scripts are company/infrastructure specific and won't really target anything but Linux and bash is always available. Even if we used a BSD for something tomorrow, it'd be trivial to add bash to those. I may be missing something, however. I guess the one place I can think of is some small-container scenarios, e.g. a bash-less Alpine, where you want the smallest possible image.
- dastx 6y agoNo, I don't think POSIX is as necessary as many people make it out to be, because it really depends on your use case. I've always been able to rely on bash both professionally and in my own projects. I am however aware of people who have to rely on posix compatibility. One of them is as you said, docker environments and alpine Linux, the other is a former colleague was working on some airgapped system where security didn't allow any additional packages to be installed, and bash wasn't installed. So their only way of scripting was either posix, or an old version of python 2 (I think it was 2.3). I don't know whose brilliant idea it was to install python, but not bash. So it really depends on your use case
- simonh 6y agoYou can tell Unix has been around a while because the "new hot thing" dates to 1990.
- michaelcampbell 6y agoHah, thanks; I was about to note that I tried zsh in ~1993 and never looked back. I do my scripts in bash, though.
- curlypaul924 6y agoI thought oil shell was the hot new thing. I really think it has the potential to displace both bash and zsh. My impression has always been that zsh is where cool new features go first, and then bash plays catch up. I remember longing for associative arrays in bash while zsh and ksh already had them. What finally got me to move to zsh was colorized syntax; it makes some of my typos very obvious before I press Enter. In general zsh is still more pleasant for interactive use, but I still write scripts in bash since it is everywhere.
- michaelcampbell 6y agozsh's killer feature for me was "splat splat" and the extended shell globbing; `<splat><splat>/foo<splat>(.x)` type stuff. Replaced `find` for a lot of my interactive stuff, although I do use `find ... -print0 | xargs -0r ...` for a lot of things yet. I do realize `bash` also has `splat splat`, now. (curse HN's splat/star pseudo-markup)
- thiht 6y agoWhat's splat splat?
- ktpsns 6y agoAn asterisk character (star). Hackernews Wickes up this character.
- kaszanka 6y agoDoes escaping work? \\ It doesn't, that's interesting. *a*b*c*d* Looks like a code block is the only option.
- deleted 6y ago[deleted]
- oftenwrong 6y ago
- agumonkey 6y agonah fish is the new new thing
- alkyon 6y agoI use zsh because of global aliases feature - allowing me to assign '| grep' to G, for example. AFAIK bash doesn't offer this functionality as yet.
- jhvkjhk 6y agoYou can use keybindings to achieve similar function, put `G: '| grep'` to your ~/.inputrc and every time you type G, you get '| grep'. This may break something because it mapped a regular letter, so maybe `Control-g: '| grep'` is better.
- koheripbal 6y agoWhat's so great about zsh?
- leokennis 6y agoAlso, I am yet to log in to a Linux machine that does not have bash. Does that even exist?
- turminal 6y agoAlpine Linux
- herewulf 6y agoThis always trips me up when I run `docker exec` to get a shell in a container that is based on Alpine. "/bin/bash" is too far ingrained in muscle memory.
- BenjiWiebe 6y agoYes. Embedded systems commonly have only sh from busybox.
- oehtXRwMkIs 6y agoaka ash
- alexhutcheson 6y agoRob Landley is working on implementing a full Bash clone (called toysh[1]) in his Toybox project[2], so hopefully the need to target BusyBox ash will go away in the near future. [1] https://github.com/landley/toybox/blob/master/toys/pending/s https://github.com/landley/toybox/blob/master/toys/pending/s... [2] http://landley.net/toybox/about.html http://landley.net/toybox/about.html
- nmz 6y agoI think debian comes with dash.
- LeoPanthera 6y agoThe install environment uses dash. A completed install includes bash.
- StreamBright 6y agoHot new thing? Zsh: Initial release 1990, 30 years ago
- jwr 6y agoLet's take a moment to remember, that while bash is good, there are other shells out there as well. UNIX is great in that it offers a choice, and we should not lock ourselves into a shell monoculture (similarly to how a web browser monoculture is bad for everyone in the end). Some of us believe rather strongly that tcsh is way better, some of us prefer zsh, and that's fine! It's a good idea to take a look at other shells, at least to know what's out there and to make an educated choice, rather than use "what most people use". So, next time you write a script or instructions, please remember that not everyone uses 'export', and also that not every /bin/sh is a bash.
- yodsanklai 6y ago> rather than use "what most people use". I personally prefer using what most people use. It may not be perfect, and I may be miss a few nice features, but I find myself more productive this way
- jwr 6y agoGreat! And you should have that choice. We should all have a choice, which was precisely my point.
- e12e 6y ago> Some of us believe rather strongly that tcsh is way better, some of us prefer zsh Those people are wrong, though ;p In all seriousness, one should look around and try a few. As a linux/Unix shell i like bash - it's posix enough that you can write posix-ish scripts (might have to run on ksh/bsds) - and these days it has good completion and other niceties. And unless you make an effort, it doesn't colorize everything to the point that it looks like your user land threw up on your terminal. Other worth looking at IMNHO ibnclude rc from plan9, fish and oilsh. And maybe dash for a small runtime for scripts.
- augustk 6y agoFor portability reasons I prefer to write POSIX shell scripts instead of Bash scripts: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V...
- zimbatm 6y agoI used to think that way, but POSIX is not that well specified and there are tons of little behavior changes that makes the task difficult past 10 lines of code. Writing portable shell scripts is like writing portable JavaScript in the IE days. https://github.com/dylanaraps/pure-sh-bible https://github.com/dylanaraps/pure-sh-bible is a good example if you look at the issue tracker. Once you accept Bash as a standard things become much easier. Basically Bash arrays, the `@Q` notation and ShellCheck combined solve all of the escaping issues that plague shell scripts.
- michaelcampbell 6y agoI can't think of a system that would be using anything I write that wouldn't have bash, honestly. Not in... 25 years or so. "portability" I guess is a goal, to a degree, for me too since I write in bash instead of zsh which I use interactively, but /bin/sh scripts for "portability" is just a fetish, IMO.
- apple4ever 6y agoYa bash is at least installed on everything modern now. Maybe that changes, but if you right for bash that's portable enough - you need to balance the work required with the risks of not doing it.
- joombaga 6y agoWhat is @Q notation?
- cb321 6y agoI belive zimbatm refers to the bash-specific ${var@Q} to expand to a form suitable as re-input into the shell. There are a few other bash-specific syntaxes like that (under "parameter transformation" in the manual page).
- pornel 6y agomacOS keeps reminding me Apple has chosen tivoization over FLOSS: $ /bin/bash --version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19) Copyright (C) 2007 Free Software Foundation, Inc.
- rational_indian 6y agoSo Apple does not show the GPLv3+ banner?
- djxfade 6y agoNo GPLv3 software is shipped with macOS. And in the second monst recent version of macOS, bash was replaced with zsh
- raimue 6y agoTo be more specific, zsh was already included before, but the default shell for new accounts is now zsh instead of bash. Apple still ships /bin/bash version 3.2 with macOS.
- noodles_nomore 6y agoBest argument for GPLv3 I've seen yet.
- taf2 6y agobrew install bash
- LordGrey 6y agoA while back I used MacPorts to install the latest bash and changed my admin user to use it. Worked great. Then Big Sur came along and I had to upgrade MacPorts. This involved uninstalling installed packages, upgrading the base MacPorts, then reinstalling the packages. Imagine my surprise -- because I didn't fully consider these actions -- when my terminal session started ignoring my commands partway through that process. It turns out that it is a Bad Idea to delete your shell binary when you're using it. Fortunately, VS Code's terminal uses a different shell binary so I was able to complete the upgrade there. Another day, another reminder to Be More Careful.
- tantalor 6y agoReminder that bash is maintained by one person, Chet Ramey. Thanks, Chet!
- stonecharioteer 6y agoOh wow. I can't fathom how one person can maintain something this wide spread for so long!
- turminal 6y agoMy favourite part of the bash(1) man page is it's BUGS section. Just the first sentence. Bash users should take a look at it from time to time.
- ExcavateGrandMa 6y agoThanks for making bash. GNU bash, version 4.3.42(1)-release (i686-pc-linux-gnu) Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org http://gnu.org /licenses/gpl.html> This is free software; you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.