1 read -r -p "Are you sure you want to remove Oh My Zsh? [y/N] " confirmation
2 if [ "$confirmation" != y ] && [ "$confirmation" != Y ]; then
3 echo "Uninstall cancelled"
7 echo "Removing ~/.oh-my-zsh"
8 if [ -d ~/.oh-my-zsh ]; then
12 if [ -e ~/.zshrc ]; then
13 ZSHRC_SAVE=~/.zshrc.omz-uninstalled-$(date +%Y-%m-%d_%H-%M-%S)
14 echo "Found ~/.zshrc -- Renaming to ${ZSHRC_SAVE}"
15 mv ~/.zshrc "${ZSHRC_SAVE}"
18 echo "Looking for original zsh config..."
19 ZSHRC_ORIG=~/.zshrc.pre-oh-my-zsh
20 if [ -e "$ZSHRC_ORIG" ]; then
21 echo "Found $ZSHRC_ORIG -- Restoring to ~/.zshrc"
22 mv "$ZSHRC_ORIG" ~/.zshrc
23 echo "Your original zsh config was restored."
25 echo "No original zsh config found"
28 if hash chsh >/dev/null 2>&1 && [ -f ~/.shell.pre-oh-my-zsh ]; then
29 old_shell=$(cat ~/.shell.pre-oh-my-zsh)
30 echo "Switching your shell back to '$old_shell':"
31 if chsh -s "$old_shell"; then
32 rm -f ~/.shell.pre-oh-my-zsh
34 echo "Could not change default shell. Change it manually by running chsh"
35 echo "or editing the /etc/passwd file."
39 echo "Thanks for trying out Oh My Zsh. It's been uninstalled."
40 echo "Don't forget to restart your terminal!"