Live data from Hacker News

How zsh is more useful than bash

slideshare.net

121–130 of 151 posts

Re: How zsh is more useful than bash

#121
post #113
post #105

Earlier quoted context omitted.

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

Sorry, I just copy-pasted the whole thing. I know that most of the other options are available, though I didn't know that the HIST_IGNORE_SPACE was available in bash.

In bash you'd use HISTCONTROL=ignorespace

Re: How zsh is more useful than bash

#122

I find the way ZSH does completions for git kind of frustrating. It's a bit overzealous and so when you try to complete a remote branch lie: "git co br " It finishes with: "git co origin/branch" Whereas what I want is: "git co branch" because I have git set up to automatically create a local branch and set it up to push to the remote when I do that. Just a small annoyance. Overall I find ZSH has cool features that do…

Not to mention that it sometimes gets super slow for no apparent reason.. which lead me to turn it off.

Re: How zsh is more useful than bash

#123
post #73
post #62

WTF? I wrote this slide deck. It was a presentation I made for a monthly "tech lunch" my team has. I made it after a couple of weeks of messing with zsh. It was for an audience of 4 other people who knew less about zsh than me. I can't believe someone posted it to HN! That explains the "this slide deck is getting traffic" email I got from Slideshare this morning.

I enjoyed the slides. Great job! Many people like me are new to whole Unix system and need trainings like this. I did not even know that I can upgrade my bash via homebrew. I don't dare to switch to zsh yet. I'm afraid if it messes up all my bash_profile, rvm stuff and Vim configs. I have a bad memory with fish_fish

Zsh was a drop in replacement for me. Worked perfectly with everything you just mentioned.

Re: How zsh is more useful than bash

#124
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, I just tried the foreground/background stuff (similar to yours, but my own code, slightly different) and it works fine in bash 4.

Re: How zsh is more useful than bash

#125

Earlier quoted context omitted.

lolwut

Bash is the gnu shell which is a superset not posix which is basic no frills mixture of minimal ksh and bourne syntax. BSD has the almquist shell as it's /bin/sh and tcsh as it's /bin/csh. Various commercial vendors licensed the korn shell from bell labs. The korn shell is public domain and open for 13 years now. The default sh on most UNIX boxes are either ash or a hard link to ksh which emulates the POSIX definitio…

Not quite sure how this is relevant. I was referring to how his/her comment didn't make sense in the context of this post.

Re: How zsh is more useful than bash

#126
post #70
post #58

Earlier quoted context omitted.

i just tried fish. out of the box experience is great. not digging much yet but so far, so good. much faster start up time than zsh. this is 2013 already and i seriously dont' want a shell takes up a second or 2 to fire up.

I use zsh on my low-spec netbook and have not noticed slow startup times for my shell. That said, I do have a minimalist setup. FreeBSD DWM dmenu

that's probably because i use zsh with prezto (a fork of oh my zsh)

Re: How zsh is more useful than bash

#127
post #110

Earlier quoted context omitted.

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)

fish passes the -G flag to 'ls' by default, which produces colorized output, but stats each file. So fish is actually outputting more information than zsh, and what your test is really measuring is the speed of '/bin/ls' vs '/bin/ls -G'

To compare ls speeds for the same workload, run it directly: /bin/ls. I expect no difference, because it is the same binary.

If you wish to compare globbing speeds, do not use bare ls, which does more work in fish. Instead, invoke the ls binary: '/bin/ls * '. Or better yet, just echo: 'echo *'.

Re: How zsh is more useful than bash

#128
post #90

Earlier quoted context omitted.

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, I just tried the foreground/background stuff (similar to yours, but my own code, slightly different) and it works fine in bash 4.

I'm unclear what you mean by foreground/background stuff. I'm looking at the manpage for bash 4.2, and I don't see any short-hand for the color escape codes in prompts.

Re: How zsh is more useful than bash

#129
post #113

Earlier quoted context omitted.

Sorry, I just copy-pasted the whole thing. I know that most of the other options are available, though I didn't know that the HIST_IGNORE_SPACE was available in bash.

In bash you'd use HISTCONTROL=ignorespace

According to the manpage, ignorespace doesn't treat multi-line commands very nicely.

Re: How zsh is more useful than bash

#130
post #100

Only through zsh did I find out about tab auto-complete. When I used bash, whenever I needed to uncompress a tarball I downloaded, I would type in the full, ~50 character filename. Only through zsh did I find out about tab autocomplete, and when I had to use bash on a friend's Mac, to my surprise, autocomplete worked. I still use zsh, though.

For a while bash autocomplete was around, but you had to know to source it from /etc, which seems dumb. Now this stuff is sourced automatically[1].

[1] And sometimes they use it as a 'cheat.' virtualenvwrapper (on Ubuntu, and I assume Debain) is dropped into /etc/bash_completion.d/ instead of somewhere in $PATH. Meaning that it's auto-sourced for bash users, but zsh users need to know where it is, and source it. It seems stupid to put it in the bash_completion directory. Sure it has some completion stuff in it, but the bulk (and purpose) of the file is to setup a bunch of wrapper shell functions. It's like they didn't have a formal place to put it so they just jammed it somewhere.

Post reply on HN