robbyrussell/oh-my-zsh — pull request #2836 by ptamarit (2014-05-27 19:56:31+00:00)
Title: Install script's chsh not working on Fedora

Running the install script on Fedora 20 (after having yum-installed zsh) throws the following error:

chsh: "/usr/bin/zsh" is not listed in /etc/shells

This is caused by the following line:

chsh -s `which zsh`

The explaination is the following:
* Running `which -a zsh` return `/usr/bin/zsh` and `/bin/zsh`, but running `which zsh` returns only the first one: `/usr/bin/zsh`.
* Checking the available shells with `chsh -l | grep /zsh$` only returns `/bin/zsh`
* That's why the `chsh -s` command fails.

Both zsh paths should be present in `/etc/shells`, but it looks like it's a Fedora bug (see [bug 1034060](https://bugzilla.redhat.com/show_bug.cgi?id=1034060)).

One way to make the shell switching more robust is to set zsh from the list of available shells returned by `chsh -l` instead. The proposed patch gets the first available shell matching `/zsh$` and sets it as the current shell.