installer: make sure shell in /etc/shells is not commented

Otherwise we risk a situation where a full path to `zsh` is commented, i.e.:

    #/usr/local/bin/zsh
This commit is contained in:
Raf Czlonka 2018-10-08 21:50:03 +01:00 committed by Marc Cornellà
parent 73f29087f9
commit 8e10ac4d73

View file

@ -97,7 +97,7 @@ setup_shell() {
# If this platform provides a "chsh" command (not Cygwin), do it, man!
if command_exists chsh; then
echo "${BLUE}Time to change your default shell to zsh!${NORMAL}"
if ! chsh -s $(grep /zsh$ /etc/shells | tail -1); then
if ! chsh -s $(grep '^/.*/zsh$' /etc/shells | tail -1); then
error "chsh command unsuccessful. Change your default shell manually."
fi
# Else, suggest the user do so manually.