diff options
author | Zach Whitten <zwhitten@gmail.com> | 2017-10-13 14:33:22 -0400 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2019-06-03 17:18:25 +0200 |
commit | 2e54ba2dfb95890c6ea32323ae14486ffc1c46ed (patch) | |
tree | 36fefd7050b99b34e0e2edf150b89f98b2eb45e4 /tools/uninstall.sh | |
parent | 66d6d08841ebde3610eaee961f63f8420e914d3b (diff) | |
download | zsh-2e54ba2dfb95890c6ea32323ae14486ffc1c46ed.tar.gz zsh-2e54ba2dfb95890c6ea32323ae14486ffc1c46ed.tar.bz2 zsh-2e54ba2dfb95890c6ea32323ae14486ffc1c46ed.zip |
installer: restore previous default shell with uninstall
Co-authored-by: Antonio QUINTAVALLE <antonio.quintavalle@amadeus.com>
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
Diffstat (limited to 'tools/uninstall.sh')
-rw-r--r-- | tools/uninstall.sh | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/tools/uninstall.sh b/tools/uninstall.sh index 9793be2a1..da31a6a14 100644 --- a/tools/uninstall.sh +++ b/tools/uninstall.sh @@ -22,14 +22,23 @@ if [ -e "$ZSHRC_ORIG" ]; then mv "$ZSHRC_ORIG" ~/.zshrc - echo "Your original zsh config was restored. Please restart your session." -else - if hash chsh >/dev/null 2>&1; then - echo "Switching back to bash" - chsh -s /bin/bash + echo "Your original zsh config was restored." +fi + +if hash chsh >/dev/null 2>&1; then + if [ -f ~/.shell.pre-oh-my-zsh ]; then + old_shell=$(cat ~/.shell.pre-oh-my-zsh) + else + old_shell=/bin/bash + fi + echo "Switching your shell back to '$old_shell':" + if chsh -s "$old_shell"; then + rm -f ~/.shell.pre-oh-my-zsh else - echo "You can edit /etc/passwd to switch your default shell back to bash" + echo "Could not change default shell. Change it manually by running chsh" + echo "or editing the /etc/passwd file." fi fi echo "Thanks for trying out Oh My Zsh. It's been uninstalled." +echo "Don't forget to restart your terminal!" |