News for hackers. Stuff that matters.
Re:Oh My zsh by pilif on Tuesday September 07, 2010 @11:16AM (#1669066)
For those wondering about the advantages of ZSH over, say, bash: ZSH was first to add programmable completions (and still comes with a huge library of these), many more configuration options, history merging and much more.

It also has a huge library of built-ins (even an FTP client).

People could call it bloated, but I see no difference in performance from Bash, so for me personally, that argument is moot.

What really made ZSH gain a spot in my heart though, is the user-friendly user's guide at

http://zsh.sourceforge.net/Guide/

This is how I learned to use the Unix shell back in 2000. It's not just a brilliant introduction into ZSH itself, it also contains a lot of information about the Unix shell in general and all written in a way that a non-Unix user can easily understand it and very quickly learn all that's needed to be productive on the command line.

Using that guide and ZSH, I learned the Unix shell, so I never bothered to go back to Bash.

Besides, being able to do

scp fi<tab> servern<tab>:/so<tab>

to have it completed to

scp file servername.example.com:/somepath

is just brilliant.

Same goes for contents of tar.(g|b)z(ip|2) archives. Or git commands. Or svn commands.

It's wonderful.

Sorry. Being a fanboy here.

Re:Oh My zsh by zokier on Tuesday September 07, 2010 @12:28PM (#1669265)
To be fair, now days even bash manages to tab complete lots of stuff like ssh/scp, git and aptitude. And yes, it's wonderful :)
Re:Oh My zsh by akkartik on Tuesday September 07, 2010 @11:45AM (#1669137)
For me the really compelling reason to use zsh is that it's "like bash, but without the gotchas." For example, $* just works, even if the args have spaces. You don't have to think about "$@" which still doesn't work sometimes.
Re:Oh My zsh by chousuke on Tuesday September 07, 2010 @11:32AM (#1669103)
I have to agree, zsh is a great shell. My only gripe with it is that compiling it on OS X is a pain in the arse because it depends on a weird documentation language called "yodl" which I haven't so far managed to install. It has some weird custom build system that doesn't seem to work.

It's a shame since I'd like the up-to-date git completions, but because I can't compile zsh I'm stuck with release versions :(

Re:Oh My zsh by ptomato on Tuesday September 07, 2010 @11:40AM (#1669125)
Have you checked out homebrew? Similar to macports/fink except much, much better, available here: http://github.com/mxcl/homebrew

In particular, their recipe for zsh compilation might help you even if you don't want to install brew itself: http://github.com/mxcl/homebrew/blob/master/Library/Formula/...

Re:Oh My zsh by pilif on Tuesday September 07, 2010 @11:47AM (#1669143)
I'm very happy with the MacPorts package myself:

    pilif@celes ~ % which zsh
    /opt/local/bin/zsh
    pilif@celes ~ % echo $ZSH_VERSION
    4.3.10
    pilif@celes ~ %
building the port went flawlessly
Re:Oh My zsh by j_baker on Tuesday September 07, 2010 @01:49PM (#1669523)
Am I the only one who gets the impression people are saying "Take a shower, hippie" under their breath every time I mention to others that I'm using zsh?
Re:Oh My zsh by pilif on Tuesday September 07, 2010 @02:19PM (#1669620)
Yeah. I kind of get the same feeling. But I stopped worrying about the various religious wars and I just use the tools I like.

ZSH is the shell I learned Unix with. ZSH is the shell I know best and thus can do the most awesome stuff with. Hence I'm using ZSH.

Others might have the same feelings towards bash. I totally accept that und usually don't try to "convert" people. But I'm also immune against their efforts in converting me.

Re:Oh My zsh by cageface on Tuesday September 07, 2010 @10:12AM (#1668920)
I once had a fairly elaborate zsh setup but over the years I've gradually migrated back to a more minimalistic bash environment instead. The dwim of some of the more exotic zsh completion functions just didn't seem to save me that much time in practice.
Re:Oh My zsh by akkartik on Tuesday September 07, 2010 @11:49AM (#1669146)
git's completion especially has gotten so elaborate that it takes too friggin' long. And my shell's frozen while I wait. I just disabled it.

But why would you switch back to bash? Even if you don't use some of the advanced zsh features?

Re:Oh My zsh by cageface on Tuesday September 07, 2010 @11:54AM (#1669159)
Bash is everywhere. It's simple. It's predictable. It just works. It does the things I need it to do. If you use the bash-completion functions in Debian you can even get pretty extensive completion features.
Re:Oh My zsh by silentbicycle on Tuesday September 07, 2010 @01:09PM (#1669409)
> Bash is everywhere

No, it isn't. Here's the Unix spec (http://www.opengroup.org/onlinepubs/007908799/), search it for bash and you won't get anything. That's a Linuxism (http://www.google.com/#q=linuxism), but it's not even on every kind of Linux.

The only standard shell on Unix is the bourne shell, and having things break because someone ignorantly hardcoded bash without using any bash-specific extensions is really annoying.

I agree it's worth the time to find a shell you like and customize it, but that's not a good reason to pick bash.

Re:Oh My zsh by cageface on Tuesday September 07, 2010 @02:04PM (#1669560)
I don't remember the last time I touched a unix other than Linux or OSX. I don't expect to anytime soon either. It's not out of prejudice either, that's just what people seem to use for most things now. I'm not really willing to sweat hypothetical portability issues between the shell scripts I write for my Linux environments and some potential solaris/bsd user down the road either.
Re:Oh My zsh by silentbicycle on Tuesday September 07, 2010 @02:32PM (#1669660)
I don't care what you use for your own shell scripts* , I just have a problem with recommending that someone use bash because "it's everywhere".

I think people are better off coding to a standard shell (as necessary), and otherwise using whatever shell makes them happy for day-to-day use. bash isn't actually the former, though, and it has strong competition for the latter, so it's probably a bad compromise.

I've also done porting for OpenBSD, and the whole bash thing is a pet peeve of mine. It's not just me, though - look at the situation with Debian and eglibc due to bugs like these (http://sources.redhat.com/bugzilla/show_bug.cgi?id=3266 http://sources.redhat.com/bugzilla/show_bug.cgi?id=9901).

* I mean, how many other problems in software are due to people prematurely overgeneralizing?

Re:Oh My zsh by cageface on Tuesday September 07, 2010 @02:57PM (#1669744)
I think people are better off coding to a standard shell (as necessary), and otherwise using whatever shell makes them happy for day-to-day use.

Sure. I'm just saying that, in my own case, switching from zsh to bash has meant that instead of worrying about making sure that zsh is installed and up to date on all my systems and that all the various addons and plugins I used to need for zsh are available, I just have to make sure my .bashrc is available. And even if it isn't I don't lose much. So I get a functional, familiar environment in all the cases that matter to me with no extra hassles.

Re:Oh My zsh by akkartik on Tuesday September 07, 2010 @03:57PM (#1669916)
My favored point on that continuum is to skip the 'various addons and plugins' and just apt-get install zsh on all my machines. To skip zsh altogether seems like throwing the baby out with the bath water. I tend to think of it as a better bash implementation.
Re:Oh My zsh by silentbicycle on Tuesday September 07, 2010 @04:47PM (#1670039)
Yeah, and while I don't use zsh, I keep all my emacs config in a git repository with my other dotfiles. That plus apt-get / pkg_add / etc. seems to solve the problem nicely.
Re:Oh My zsh by lukehasnoname on Tuesday September 07, 2010 @02:03PM (#1669555)
Which Linux distros with more than 5 downloads DON'T have bash as the login shell?
Re:Oh My zsh by silentbicycle on Tuesday September 07, 2010 @02:25PM (#1669643)
http://openwrt.org/ , and embedded stuff in general, because bash is incredibly bloated.
Re:Oh My zsh by Mod_daniel on Wednesday September 08, 2010 @03:45AM (#1671318)
Please, correct me if I'm wrong, but doesn't OpenWrt run on on busybox? Which is pretty much just a stripped down conglomerated bash?
Re:Oh My zsh by silentbicycle on Wednesday September 08, 2010 @09:36AM (#1671769)
bash refers to a specific shell implementation, not the whole userland utilities (AKA the "coreutils").

BusyBox combines a bunch of Linux userland utilities into one executable, to save overhead on embedded systems. It uses ash, not bash.

Re:Oh My zsh by bch on Tuesday September 07, 2010 @02:32PM (#1669659)
Of course BSD isn't Linux, but NetBSD, FreeBSD, and surely (I'm guessing) OpenBSD don't have Bash installed by default. I'd bet Dragonfly is same.
Re:Oh My zsh by AlecSchueler on Tuesday September 07, 2010 @02:09PM (#1669570)
zsh is the login shell on PureDyne as far as I remember. It does have bash installed by default though.
Re:Oh My zsh by marshally on Tuesday September 07, 2010 @11:07AM (#1669039)
I currently use oh-my-zsh on a daily basis, but recently I've been thinking about switching back to the plain old bash shell. I have been frequently stung when new libraries come out that only support bash.
Re:Oh My zsh by tednaleid on Tuesday September 07, 2010 @12:45PM (#1669330)
I do something similar to this and have the majority of my zshrc version controlled and publicly available.

http://bitbucket.org/tednaleid/shared-zshrc

I put together a blog post on how to use it along with some descriptions of specific aliases/functions that I find really useful:

http://naleid.com/blog/2009/05/13/shared-zshrc-file/

Global aliases are one of the things I love about zshrc. In addition to that, the file globbing is a huge productivity benefit. Being able to use "/foo.txt", rather than "find . -name foo.txt" is nice.

I think that everyone should also learn the cursor movement keybindings (which default to the emacs ones instead of vi ones). I think these might be the same in bash (where C is control and M is meta, likely alt/option or escape):

* C-r - search backwards through history

* C-a - beginning of line

* M-b - move back one word

* C-b - move back one letter

* C-f - move forward one letter

* M-f - move forward one word

* C-e - end of line

* C-s - search forwards through history

Re:Oh My zsh by dreur on Tuesday September 07, 2010 @08:39AM (#1668715)
Personally I use ZshKit : http://github.com/dreur/zshkit
Re:Oh My zsh by Symmetry on Tuesday September 07, 2010 @10:46AM (#1668984)
Ah, I was sort of hoping to find that someone had made a theme with syntax highlighting as useful as fish's.
Re:Oh My zsh by mxavier on Tuesday September 07, 2010 @03:55PM (#1669910)
This will be great. I've been using zsh for probably a year now but I'm definitely underutilizing it. vi mode for zsh seems to be better implemented in zsh and thats something I could definitely not survive without.