News for hackers. Stuff that matters.
Re:Zsh 5.0 released by riobard on Monday July 23, 2012 @01:24AM (#4279667)
I know this has been asked thousands times before, but I want to know with this latest release, should I switch from Bash to Zsh now? What features do Zsh offer which are not in Bash?

Currently I'm thinking about the Fish-style syntax highlighting. Fish is really nice, but it's not very compatible with the rest of the shell environment. So I'm back on Bash, but really miss the syntax highlighting. I need some good reasons to switch again...

Re:Zsh 5.0 released by greyfade on Monday July 23, 2012 @01:44AM (#4279725)
Completion in Zsh alone made it worthwhile for me. The completion scripts for Zsh are worlds more powerful and complete than anything I've found for Bash.

And, there's even a script that offers Fish-like syntax coloring for Zsh: https://github.com/zsh-users/zsh-syntax-highlighting/

But not having used Fish yet myself, I can't really offer any reasons to use Zsh over Fish.

Re:Zsh 5.0 released by jamie_ca on Monday July 23, 2012 @12:15PM (#4281684)
I've been using fish exclusively for about 2 years, and the only thing I really missed was smart tab-completing multiple directories, like cd l/a/t/b<tab> completing to Library/Application\ Support/TextMate/Bundles even if there's another top-level directory starting with L.

Fish's consistent syntax for conditionals/loops is what brought me over in the first place, I always needed to work to remember what goes where in zsh/bash. For one-off tasks the reduction in mental overhead was a _huge_ win.

That said, I recently did switch back to zsh for a functional command-not-found handler - fish's only includes the name of the binary rather than the whole command, so I couldn't productively use it as a retry wrapper.

Re:Zsh 5.0 released by Produce on Monday July 23, 2012 @06:40AM (#4280359)
>I can't really offer any reasons to use Zsh over Fish.

Bash script compatibility, bigger userbase and therefore more third party customizations.

Re:Zsh 5.0 released by paul-woolcock on Monday July 23, 2012 @09:49AM (#4280931)
Definitely this. I switched to Fish for a while and was very happy, but the lack of Bash compatibility got a very old after a while. You never think about how much out there assumes you have a sh/bash-compatible shell running, and watching ordinary tasks fail hard because of an incompatible shell gets very, very frustrating.
Re:Zsh 5.0 released by Afal on Monday July 23, 2012 @06:30AM (#4280336)
The problem I have with zsh is that I don't really notice any benefits from it after switching from bash or whatever. I guess my problem is that I'm still using it like bash, which probably isn't a bad thing but I'm probably missing out on the other features it has.

Thing is there's no real feature I've noticed that made me think "Wow! How did I live without this?". Yeah I see some nice things but they feel like party tricks rather than game changing features.

I dunno, maybe I'm not seeing the big picture here. Is there anything out there that'll show what amazing things that zsh can do? Like is there anything out there that could make me stop using it like bash?

Re:Zsh 5.0 released by gsa on Monday July 23, 2012 @06:56AM (#4280388)
My favourite feature is shared command line history among all open shells. It was my "how I lived without that" feature, and one which I use a lot. Of course, it's only useful if you use the shell for extended periods.

The glob features are certainly quite useful too, for example, if there's a file nested deep inside some directory I can just enter

    vim **/filename 
and zsh will expand it for me.
Re:Zsh 5.0 released by zurn on Monday July 23, 2012 @12:40PM (#4281835)
works in bash too, enable it with shopt -s globstar.
Re:Zsh 5.0 released by ithkuil on Monday July 23, 2012 @07:16AM (#4280424)
should be there in bash 4
Re:Zsh 5.0 released by dserodio on Monday July 23, 2012 @09:43AM (#4280890)
Besides the awesome TAB completion, here are a few features that I use daily:

- Keyboard navigation for TAB completion (using the arrows)

- Coloured TAB completion

- "for" one-liners: for f in /*.py; wc -l $f

- Named directories (cd ~named_dir)

(edit: formatting)

Re:Zsh 5.0 released by adamrt on Monday July 23, 2012 @12:43PM (#4281851)
This is not an attempt to argue with your feature list. Bash clearly doesn't do some of those. But I just noticed the for one-liners you mentioned. I do that in bash alot actually. This is just fyi for anyone reading, not trying to argue with your feature list.

for f in *.py; do wc -l $f; done

also, you can do something like

for f in `find project_name`; do wc -l $f; done t work on the output of another command.

Cheers!

Re:Zsh 5.0 released by Afal on Monday July 23, 2012 @10:23AM (#4281098)
That for loop looks pretty neat, however I don't tend to write loops that often on the command line so it doesn't really benefit me that much.
Re:Zsh 5.0 released by chasingtheflow on Monday July 23, 2012 @09:31AM (#4280830)
Re:Zsh 5.0 released by Afal on Monday July 23, 2012 @10:13AM (#4281033)
Erm.. ok? If you don't mind me asking, why would I want to look at that? I can't really tell what it can do for me other than "make zsh more awesome". How? How does it make it more awesome?
Re:Zsh 5.0 released by andywhite37 on Monday July 23, 2012 @11:21AM (#4281382)
The thing I liked about oh-my-zsh when I switched from another shell was that it provided a wide variety of pre-built "plugin" scripts for customizing the shell for various environments/tasks. It's worth a try to just get a tour of some features available in zsh, and have some examples to look at. I don't know enough about either bash or zsh to list out feature-by-feature differences, but if you want a practical, real-world tour of zsh, oh-my-zsh is a good place to start.
Re:Zsh 5.0 released by zapman449 on Monday July 23, 2012 @04:19PM (#4282886)
People have mentioned syntax-highlighting, which is cool, and I'll be checking it out shortly.

But MY favorite feature of zsh is ZLE: the Zsh Line Editor. The fact that I hit up-arrow, and see the for|while|if statements as I typed them, rather than mashed together into a horrible, semi-colon infected, one-liner (like bash) is awesome.

Re:Zsh 5.0 released by thebillywayne on Monday July 23, 2012 @11:33PM (#4284249)
If I understand your problem with bash correctly, it can be remedied using `shopt -s cmdhist` and `shopt -s lithist`.

I commonly write long for loops in the shell and hitting the up arrow to bring it back up, should I want to edit it, etc., then it appears with all the newlines just as I typed it.

http://www.delorie.com/gnu/docs/bash/bashref_108.html

Re:Zsh 5.0 released by tammer on Monday July 23, 2012 @10:23AM (#4281103)
I know it seems like a big jump, but once you've gotten the swing of things you'll wonder why you ever bothered worrying.

Don't worry about learning all the benefits at once. Make your shell look exactly like what you've got now and figure out the new features as you go along. There'll always be something new to make you smile.

Re:Zsh 5.0 released by tome on Monday July 23, 2012 @01:44AM (#4279723)
I switched to zsh a couple of years ago, and I wish I'd never even started with bash! It's one of the few app changes I've made where I unequivocally regret not having made it sooner (the other notable one is sawfish -> xmonad -- make of that what you will!)
Re:Zsh 5.0 released by hesselink on Monday July 23, 2012 @05:29AM (#4280214)
But the OP asked why, not if, he should switch.
Re:Zsh 5.0 released by srathbun on Monday July 23, 2012 @09:40AM (#4280873)
I switched because of the massive control over the prompt.

I've currently got a three line prompt that includes info about my current repository: (git)[45afc8f02fef U master [origin/master ] ]

It lists type (git/hg) [checkout (U)pdated branch [remote branch] ]. It'll tell you how many branches different the remote is, what you are up to (staged), and colors.

That, better tab completion, and syntax highlighting of the command line are my killer features. I'm running a fork of the oh-my-zsh project, so you can see the features by grabbing a copy: https://github.com/srathbun/oh-my-zsh

Re:Zsh 5.0 released by syncopate on Monday July 23, 2012 @02:25AM (#4279821)
My favorite feature is that zsh offers vi mode when editing your commandline, just press ESC.
Re:Zsh 5.0 released by a3_nm on Monday July 23, 2012 @03:23AM (#4279939)
Bash also supports set -o vi.
Re:Zsh 5.0 released by ch0wn on Monday July 23, 2012 @03:41AM (#4279981)
This is usually the first command I type after I ssh onto something.
Re:Zsh 5.0 released by shurane on Monday July 23, 2012 @04:20AM (#4280068)
But zsh can tell you if you're in insert or normal mode. And it has RPROMPT!
Re:Zsh 5.0 released by braindead_in on Monday July 23, 2012 @01:28AM (#4279676)
I switched solely for the reason Zsh has command substring search. It's a huge timesaver for some who spends more than 50% of time on the terminal.
Re:Zsh 5.0 released by qznc on Monday July 23, 2012 @01:38AM (#4279711)
Ctrl-R in bash?
Re:Zsh 5.0 released by ComputerGuru on Monday July 23, 2012 @02:00AM (#4279766)
No, substring searches.

Ctrl+R in bash (by default, at least) will not search from the middle of a command. For instance, if the previous command was "hello", searching for "ello" will not bring it up. Whereas with zsh, it will.

Re:Zsh 5.0 released by haberman on Monday July 23, 2012 @02:17AM (#4279804)
The default bash on OS X (3.2.48(1)-release) just did when I tried it.
Re:Zsh 5.0 released by lloeki on Monday July 23, 2012 @03:25AM (#4279943)
Ctrl+R definitely works that way with bash, but I think he may be referencing tab completion:

    > ell<TAB>
    Completing external command
    git-shell  xdmshell   xkbbell  
    Completing shell function
    _ispell
Re:Zsh 5.0 released by rcfox on Monday July 23, 2012 @08:11PM (#4283675)
I wish there were ido-style searching, where typing "slstr" would match "some long string". (Provided, of course, there were no other strings that were a closer match.)