uninstall.sh 1020 B

12345678910111213141516171819202122232425262728293031323334
  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"
  4. exit
  5. fi
  6. echo "Removing ~/.oh-my-zsh"
  7. if [ -d ~/.oh-my-zsh ]; then
  8. rm -rf ~/.oh-my-zsh
  9. fi
  10. echo "Looking for original zsh config..."
  11. if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ]; then
  12. echo "Found ~/.zshrc.pre-oh-my-zsh -- Restoring to ~/.zshrc";
  13. if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
  14. ZSHRC_SAVE=".zshrc.omz-uninstalled-$(date +%Y%m%d%H%M%S)";
  15. echo "Found ~/.zshrc -- Renaming to ~/${ZSHRC_SAVE}";
  16. mv ~/.zshrc ~/"${ZSHRC_SAVE}";
  17. fi
  18. mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc;
  19. echo "Your original zsh config was restored. Please restart your session."
  20. else
  21. if hash chsh >/dev/null 2>&1; then
  22. echo "Switching back to bash"
  23. chsh -s /bin/bash
  24. else
  25. echo "You can edit /etc/passwd to switch your default shell back to bash"
  26. fi
  27. fi
  28. echo "Thanks for trying out Oh My Zsh. It's been uninstalled."