7 ms·
+1. I don't really understand why you wouldn't use zsh, or something more powerful than bash.
by jlongster 15y ago
+1. I don't really understand why you wouldn't use zsh, or something more powerful than bash.
- maratd 15y agoBecause bash is the standard on Linux and every component you add introduces additional complexity and instability. It's fine to add stuff to your home machine, but you need to be careful with adding things to a server or a work environment. Bash is good enough for almost everything.
- endlessvoid94 15y agoFind me a real world case where switching from bash to zsh was a bad idea.
- adestefan 15y agoIt would be too much of a PITA for me to compile zsh for every OS/arch that I work with in a given day. I ssh to dozens of machines in a day ranging from modern Linux to ancient versions of Solaris and HPUX. Over 10 years ago we added bash to our standard software that will be on every system we have, which means I know that my bash configuration will be the same across every single platform.
- CJefferson 15y agoScripts with no '#' line at the top are run in bash by bash, and in sh by zsh (at least on my machine). I had a program which used a bunch of such scripts, which broke in zsh.
- saurik 15y agoEven if the answer is "none", zsh will need to additionally defend "what is the advantage of zsh for someone who already knows how to use bash", as any form of switch is going to come with a cost. I would therefore be really interested in your reasons (I use bash, as currently do all of the people I know and work with; [edit: apparently except one]). It seems like most of the features listed as better than bash are either a) covered by bash 4.0, b) bad ideas (shared history among sessions), or c) only controversially better (searching around, people seem to argue back/forth about which programmable completion implementation is faster/better).
- xyzzyb 15y agozsh had me when I realized that 1) it's a drop in replacement for bash. All those scripts you have around have #!/bin/bash at the top, they will still work exactly as they always have. 2) You can selectively go back through your command history. You can arrow-up to go to previous commands just like in bash. But if you start a command (say, ssh) and then arrow-up you will then be cycling back through the last ways you entered that command. Super convenient.
- BCM43 15y agoBut if you start a command (say, ssh) and then arrow-up you will then be cycling back through the last ways you entered that command. Like Ctrl+R?
- xyzzyb 15y agoNot exactly, but similar. If you want to see a demo, Ryan Bates highlights this feature (among others) with his ZSH screencast: http://railscasts.com/episodes/308-oh-my-zsh http://railscasts.com/episodes/308-oh-my-zsh
- bretthoerner 15y ago> You can arrow-up to go to previous commands just like in bash. But if you start a command (say, ssh) and then arrow-up you will then be cycling back through the last ways you entered that command. Or, if you'd like to do this in Bash, and any program that uses readline: In ~/.inputrc # Bind the up arrow to history search, instead of history step "\e[A": history-search-backward # And the reverse (down) "\e[B": history-search-forward
- eridius 15y agoI find it easier to just hit ^R when I want to search my history. And since that's a default keybinding, it works on any machine I touch.
- threedaymonk 15y ago
- rwg 15y agoWell, I switched from csh to zsh and almost got arrested. While a senior in high school (~15 years ago), I was also enrolled at the local university and taking a few 1000- and 2000-level Math and CS courses. About halfway into the spring semester, my account on the CS department's crusty old Sun box was locked, and my CS professor that semester told me to report to the system administrator's office after class. When I arrived at the system administrator's office, the department's system administrator and the department head were waiting for me. The sysadmin immediately (and angrily) said that if this were anywhere but a university, he'd see that I was thrown in jail. When I asked what he was talking about, he turned to his computer, banged on the keyboard for a bit, and turned the massive CRT so I could read it. On his screen was an e-mail I had sent him the semester before asking that he change my shell from /bin/csh to /usr/local/bin/zsh. (Solaris of that vintage didn't have chsh, so I couldn't do it myself.) The sysadmin was absolutely convinced that zsh gave me "elevated system privileges", even though he was the one that changed my passwd entry and presumably was the one who compiled and installed zsh in the first place. When I argued that /usr/local/bin/zsh didn't have the suid or sgid bits and therefore gave me no more access to the system than any other shell, the department head scolded me for arguing with the (experienced, wise) sysadmin. The sysadmin changed my shell back to csh, and the department head made me sign a document stating that I wouldn't change my shell back to zsh or try to "further gain administrative access" to the system. On the drive home, I idly wondered whether going to (a different!) college full-time in the fall was really such a hot idea...
- piinbinary 15y agoNot actually zsh's fault, but that's pretty amusing (now, at least - I bet it wasn't amusing then).
- snprbob86 15y agoWith the caveat that you should always pick your battles... You should have never signed that. Even if you struck the word "further", it'd probably be seen as an admission of guilt in court.
- mgedmin 15y agoI tried, for a week, got very frustrated and switched back. The little itch that drove me crazy was command-line editing: in bash (and all readline apps) when I have command long/path/to/some/file I can press Alt-Backspace to delete 'file', or I can press Ctrl-W to delete 'long/path/to/some/file'. I tried various hacks to make zsh do the same, then gave up.
- shabble 15y agobindkey '^[^?' backward-kill-word might do the trick? (possibly '^[^h' depending on what your backspace key sends. Ctrl-v <backspace> should give you something you can copy)
- mgedmin 15y agoThis makes Alt-Backspace do the same thing as Ctrl-W, which is delete-everything-until-the-next-space. I'm missing the delete-last-segment-of-the-path function. Edit: I know I can customize the word style using $WORDCHARS, or 'autoload select-word-style'; my problem is that I'm used to having the capability to use two different word styles at once. I'm looking through the command list in zshzle(1), and I'm a bit confused about the differences between backward-delete-word and backward-kill-word. Some short experiments I did failed to notice any differences (foo/bar/baz M-x backward-delete-word deletes foo/bar/baz). There's also vi-backward-kill-word which deletes 'baz', then '/', then 'bar', then '/', then 'foo'. I want a key to delete 'baz', then 'bar/', then 'foo', and I've no idea how to get it...
- shabble 15y agoHrmm. It works as you want for me, but there may be some other config item I've set. The other alternative is to try: autoload -U select-word-type select-word-type bash which should override C-w to do what you want. I haven't looked at it enough to see if you can get both behaviours simultaneously though (and it requires a fairly recent zsh iirc)
- kree10 15y agoSo you could say bash is the Internet Explorer of shells. It's the default, it's what most people use, and it's good enough.
- maratd 15y agoNo, I would not say that. Internet Explorer is the default on Windows because Microsoft makes it, not because it's the best option for a default. Bash is the default because it's the best shell to be used as a default. Nobody is twisting the arm of any distribution, but they set it as the default anyway. There's a reason for that.
- grogs 15y agoBecause it was at some point when the decision was made, for a few distributions. How often is this decision re-evaluated? ...personally I just hit Ctrl+C again to reset my prompt.
- kree10 15y agoI think that reason is mostly inertia. Also, because it's GNU. Just as IE is the Microsoft browser, bash is the GNU shell, and most Linux distributions are built around GNU userland. But that's just Linux. The BSDs don't see bash as the best default, where it tends to only be available as an optional package.
- joshAg 15y agoI don't use zsh because I don't spend a lot of my time at the shell or do anything complex with it when I am using it. Most of my time is spent in a text editor, and for the little amount of time I spend doing things on the shell, bash (or really, whatever the heck the default shell is) has worked fine for the basic tasks I need it for. I suppose it's possible that I'd like zsh more than bash even for what I'm doing now, but honestly, I don't even think about bash. It's just there, and it works enough of the time that I don't even have any complaints about it.
- wahnfrieden 15y agoI use and prefer zsh, but a lot of developers who use OSX don't realize that they're using a version of bash that's roughly 5 years out of date - from when GNU switched over from GPLv2 to GPLv3, which Apple can't use any code from. Bash has come a long way since then and it's just a "brew install bash" away. There's absolutely no good reason to stick with the version that ships with OSX for your personal shell. I'm not sure which zsh OSX ships with, but it should be much more up to date since it uses a BSD-like license.
- eridius 15y agoThe last time I tried upgrading to bash 4.0 using `brew install bash`, I was shocked to discover that it couldn't detect when I was logging in over ssh anymore. Such logins ended up giving me the non-login shell, which didn't source any of my normal stuff.
- wnoise 15y agoWhich Apple _won't_ use any code from. They're certainly capable of doing so, both legally and physically. They choose not to.
- batista 15y agoA lot of companies won't use any code in GPLv3. "Legally capable" is one thing, "completely out of any possible problems in the future" is another.
- nardi 15y agoWhich Apple _can't_ use any code from without releasing the source code to Mac OS X. GPL3 is toxic.
- glogla 15y agoNot really. GPL3 differs from GPL2 in following things: 1) Patents, i.e. you can't circumvent GPL3 by using GPL software as something you build your software on, but then don't share it because while source code may be available, you patent the code. It was possible with GPL2. 2) DMCA, i.e. you can't circumvent GPL3 with using DMCA which makes circumventing DRM illegal in US. It was possible with GPL2. 3) Tivoization, i.e. you can't circumvent GPL3 using digital encryption, when you release the source code, but not the necessary cryptographic keys. In other ways, GPL3 is pretty much the same as GPL2. Using GPL3 bash would not make Apple release source code of Mac OS X any more than using GPL2 bash. The only reason not to use GPL3 (1) is when you don't want the three things I listed above taken from you. I would suggest that makes any company with "no GPL3" policy toxic, not GPL3. Should you want to educate yourself, here's a link that explains it pretty well: http://www.linuxfordevices.com/files/misc/GPLv2_vs_GPLv3.pdf http://www.linuxfordevices.com/files/misc/GPLv2_vs_GPLv3.pdf (1): It's very different with AGPL
- njharman 15y ago> something more powerful than bash Power beyond need or capability is complexity (the bad kind).
- acdha 15y agoI spend a lot of time in the shell and it's so incredibly rare for what I'm doing to be limited by bash that it's hard to describe switching to zsh as anything other than a premature optimization. Part of this is because I try to automate anything I do more than once or twice and I use a real language to do so. For anything non-trivial the differences between zsh and bash are an order of magnitude less significant than either compared with Python, Ruby, etc.
- epo 15y agoc.f.the banal argument often put forward by OSS zealots, "why use Windows, Linux is so much better". In brief, bash, like mysql (or Windows) is always there. Most people know how to use bash and wouldn't notice any difference by switching (except for a possible unnecessary learning curve). Lets turn it around. Assuming (and a big assumption) that zsh is more powerful, why does this matter to someone who probably spends most of their time at a terminal thinking and puts anything half way repetitive into a script? Its like telling a carpenter than a brand X chisel is more powerful than a brand Y chisel. Show me how a skilled zsh user is 'more powerful' than a skilled bash user at anything that matters. Perhap some people spend too much time typing and not enough time thinking.
- zurn 15y agoMaybe you happen to be one of those developers who's happy and comfortable to make the app/project using whatever externally mandated set of tools happen to be at hand. That's an advantage, even though it I think it also has a flip side.