uninstall.sh 952 Bytes
Newer Older
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
5
  echo "Uninstall cancelled"
  exit
6
7
fi

Robby Russell's avatar
Robby Russell committed
8
echo "Removing ~/.oh-my-zsh"
9
if [ -d ~/.oh-my-zsh ]
Robby Russell's avatar
Robby Russell committed
10
11
12
13
then
  rm -rf ~/.oh-my-zsh
fi

14
echo "Looking for original zsh config..."
Robby Russell's avatar
Robby Russell committed
15
16
if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ]
then
17
18
19
20
21
22
23
24
25
26
27
  echo "Found ~/.zshrc.pre-oh-my-zsh -- 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};
  fi

  mv ~/.zshrc.pre-oh-my-zsh ~/.zshrc;

Robby Russell's avatar
Robby Russell committed
28
29
  source ~/.zshrc;
else
30
31
32
33
34
35
36
  if hash chsh >/dev/null 2>&1
  then
    echo "Switching back to bash"
    chsh -s /bin/bash
  else
    echo "You can edit /etc/passwd to switch your default shell back to bash"
  fi
Robby Russell's avatar
Robby Russell committed
37
38
fi

39
echo "Thanks for trying out Oh My Zsh. It's been uninstalled."