summaryrefslogtreecommitdiff
path: root/tools/uninstall.sh
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2019-10-24 17:57:01 +0200
committerGitHub <noreply@github.com>2019-10-24 17:57:01 +0200
commitcad48e38bfbfa6e3e0096caddf330d6fc8f1ffb9 (patch)
tree2b07ec259bbd2b1a4919245669900a87fa87a03b /tools/uninstall.sh
parent225425fe091ca052997833279ccc08643818c24a (diff)
parent40df67bc3b9b51caa24df5d220487043040d1f9a (diff)
downloadzsh-cad48e38bfbfa6e3e0096caddf330d6fc8f1ffb9.tar.gz
zsh-cad48e38bfbfa6e3e0096caddf330d6fc8f1ffb9.tar.bz2
zsh-cad48e38bfbfa6e3e0096caddf330d6fc8f1ffb9.zip
Merge branch 'master' into fabric_task_description
Diffstat (limited to 'tools/uninstall.sh')
-rw-r--r--tools/uninstall.sh36
1 files changed, 23 insertions, 13 deletions
diff --git a/tools/uninstall.sh b/tools/uninstall.sh
index bf2244be8..da31a6a14 100644
--- a/tools/uninstall.sh
+++ b/tools/uninstall.sh
@@ -10,25 +10,35 @@ if [ -d ~/.oh-my-zsh ]; then
fi
echo "Looking for original zsh config..."
-if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ]; then
- echo "Found ~/.zshrc.pre-oh-my-zsh -- Restoring to ~/.zshrc";
+ZSHRC_ORIG=~/.zshrc.pre-oh-my-zsh
+if [ -e "$ZSHRC_ORIG" ]; then
+ echo "Found $ZSHRC_ORIG -- Restoring to ~/.zshrc"
- if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
- ZSHRC_SAVE=".zshrc.omz-uninstalled-$(date +%Y%m%d%H%M%S)";
- echo "Found ~/.zshrc -- Renaming to ~/${ZSHRC_SAVE}";
- mv ~/.zshrc ~/"${ZSHRC_SAVE}";
+ if [ -e ~/.zshrc ]; then
+ ZSHRC_SAVE=~/.zshrc.omz-uninstalled-$(date +%Y-%m-%d_%H-%M-%S)
+ echo "Found ~/.zshrc -- Renaming to ${ZSHRC_SAVE}"
+ mv ~/.zshrc "${ZSHRC_SAVE}"
fi
- mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc;
+ 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!"