uninstall.sh 958 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. read -r -p "Are you sure you want to remove Oh My Zsh? [y/N] " confirmation
  2. if [ "$confirmation" != y ] && [ "$confirmation" != Y ]
  3. then
  4. echo "Uninstall cancelled"
  5. exit
  6. fi
  7. echo "Removing ~/.oh-my-zsh"
  8. if [ -d ~/.oh-my-zsh ]
  9. then
  10. rm -rf ~/.oh-my-zsh
  11. fi
  12. echo "Looking for original zsh config..."
  13. if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ]
  14. then
  15. echo "Found ~/.zshrc.pre-oh-my-zsh -- Restoring to ~/.zshrc";
  16. if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]
  17. then
  18. ZSHRC_SAVE=".zshrc.omz-uninstalled-`date +%Y%m%d%H%M%S`";
  19. echo "Found ~/.zshrc -- Renaming to ~/${ZSHRC_SAVE}";
  20. mv ~/.zshrc ~/${ZSHRC_SAVE};
  21. fi
  22. mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc;
  23. source ~/.zshrc;
  24. else
  25. if hash chsh >/dev/null 2>&1
  26. then
  27. echo "Switching back to bash"
  28. chsh -s /bin/bash
  29. else
  30. echo "You can edit /etc/passwd to switch your default shell back to bash"
  31. fi
  32. fi
  33. echo "Thanks for trying out Oh My Zsh. It's been uninstalled."