Live data from Hacker News

How zsh is more useful than bash

slideshare.net

101–110 of 151 posts

Re: How zsh is more useful than bash

#102

I think the zsh-vs-bash debate is centered on minimalist vs. full-featured. For instance, the git completion example is very ugly in zsh to me. I know what git commands do, and I'd much prefer for the completion to take 1-2 lines total than one line per possible command, as in the zsh example. The prompt examples are similar -- my PS1 is local green="$(tput setaf 2)" local reset="$(tput sgr0)" export PS1="\[$green\]>…

The spellcheck isn't even on by default.

Re: How zsh is more useful than bash

#103
post #92

Earlier quoted context omitted.

Maybe I'm just not enough of a 'power user,' but I've been using Zsh since 2008 ~ 2009, and I rarely encounter the command-correction. The couple of times I've had it invoked were times where it correctly fixed a typo.

It does fix typos for me too, but most of the time asks weird things like, I typed 'aptitude' did I mean '.aptitude'? It loves misinterpreting some of my commands as dotfiles. Huh? Then again I have a knack for unintentionally breaking computers, so maybe I've done something in env or rc that's messed it up...

Using the following got rid of a lot of my correction woes:

    alias sudo="nocorrect sudo"
That is why you were getting the .aptitude one, you can use it for other commands that it gets the corrections wrong often.

I've since moved to vanilla bash+bash completion since it is everywhere and zsh completion seemed to annoy me more than help me.

Re: How zsh is more useful than bash

#105
post #90

I think the zsh-vs-bash debate is centered on minimalist vs. full-featured. For instance, the git completion example is very ugly in zsh to me. I know what git commands do, and I'd much prefer for the completion to take 1-2 lines total than one line per possible command, as in the zsh example. The prompt examples are similar -- my PS1 is local green="$(tput setaf 2)" local reset="$(tput sgr0)" export PS1="\[$green\]>…

local green="$(tput setaf 2)" local reset="$(tput sgr0)" export PS1="\[$green\]>>\[$reset\] " Could be this in zsh: export PS1="%{%F{green}%}>>%{%f%} " - %{%} replace \[\] - %F{color} sets the foreground colour - %f resets the foreground colour I would go with something like: export PS1="%{%(?.%F{green}.%F{red})%}>>%{%f%} " It will be green if the last command exiting successfully, otherwise it will be red. There's a…

Actually, except the `SHARE_HISTORY` option (which can be emulated), everything else is available in Bash.

Re: How zsh is more useful than bash

#106
Normally, these slideshares are difficult to follow since the subtleties of an actual presentation are missing. This is not the case here: kudos to the author. After reading the comments that I can transfer over all my .bash_* information, I will be doing so.

Re: How zsh is more useful than bash

#107
post #56

Earlier quoted context omitted.

Yes. Not only that but it has something even cooler: ESC + Q Let's say you are about to finish a really long command and realize you should have done one other command first. ESC + Q clears the current line, lets you enter a command, and then inserts the cleared line again on the next prompt. You have to try it to realize how cool it is.

> Yes. Not only that but it has something even cooler: ESC + Q ESC+. does not work for me with zsh. zsh 4.3.11 (i386-apple-darwin12.0) Maybe it's the version. ESC+Q also doesn't clear the line. At the same time, the OP links slide deck fails for me at the cd /u/lo/b part. It simply doesn't work.

I can only confirm it works on zsh 5.0 on Ubuntu. And the /u/lo/b expansion works as well.

Re: How zsh is more useful than bash

#108

That's actually the first time I've seen a decent set of reasons why zsh is worth using. Well done. Almost every other "Switch from bash to zsh, it has this awesome killer feature" article I've seen has raved about a feature that's available in Bash & has been for years. I'm starting at a new job in a month or so, I shall try & use it as an opportunity to switch to zsh since I won't have any can't-live-without bash s…

> Almost every other "Switch from bash to zsh, it has this awesome killer feature" article I've seen has raved about a feature that's available in Bash & has been for years.

Yeah, I feel the same way. Most people seem to act like bash doesn't have tab completion or customizable prompts or something. This is actually the first time I've seen actual useful features of zsh that bash actually does not have (path expansion for instance). But I actually have my own little workaround scripts for those types of things that I'm used to so I don't feel a huge compelling reason to switch. The multiple shell history thing is a pretty good reason though. Maybe I'll switch eventually.

Re: How zsh is more useful than bash

#109
post #76

Path replacement is also possible in bash, as in: cd site1 site2 if you just add this line to your ~/.bashrc: function cd() { if [ $# -eq 2 ]; then builtin cd ${PWD/$1/$2}; else builtin cd $1; fi }

that way all zsh functionality is "possible" if you write those functions.

There's no equivalent for the nifty tab completion where you can navigate around though. That's one of the few things I envy from zsh as a bash user.

Re: How zsh is more useful than bash

#110
post #82

Earlier quoted context omitted.

I just tried fish and after half a minute declared it too slow: it is slow to complete (and not very good) and slow to print (or maybe slow to glob: "ls " takes far more time in fish than in bash or zsh). I do not know if it has all I love in zsh (things like (.) or (om^/) or * or !$), but I would not trade zsh's completion for gaining 10% on startup time.

Current fish author here. Thanks for giving fish a try! I hope you tested a 2.0 branch build, and not the 1.x train from 2009 - a lot has changed since then, including major performance improvements. Check $FISH_VERSION if you are unsure. 'ls' is slower on fish because it passes the -G ("colorize”) flag to /bin/ls, which gives you nice colors, but requires a stat of each file to determine its type. If you want faster…

I just checked and fish is way slower at 'ls *' than zsh. (zsh was done 2x as fast even with a directory with more than 3x as much stuff in it)

I have also a few other flags set in my zsh aliases that's not in fish.

(Tested with 2.0b2)

Post reply on HN