uninstall.sh 957 Bytes
Newer Older
1
read -r -p "Are you sure you want to remove Oh My Zsh? [y/N] " confirmation
LE Manh Cuong's avatar
LE Manh Cuong committed
2
if [ "$confirmation" != y ] && [ "$confirmation" != Y ]; then
3
4
  echo "Uninstall cancelled"
  exit
5
6
fi

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

12
echo "Looking for original zsh config..."
LE Manh Cuong's avatar
LE Manh Cuong committed
13
if [ -f ~/.zshrc.pre-oh-my-zsh ] || [ -h ~/.zshrc.pre-oh-my-zsh ]; then
14
15
  echo "Found ~/.zshrc.pre-oh-my-zsh -- Restoring to ~/.zshrc";

LE Manh Cuong's avatar
LE Manh Cuong committed
16
  if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then
LE Manh Cuong's avatar
LE Manh Cuong committed
17
    ZSHRC_SAVE=".zshrc.omz-uninstalled-$(date +%Y%m%d%H%M%S)";
18
    echo "Found ~/.zshrc -- Renaming to ~/${ZSHRC_SAVE}";
LE Manh Cuong's avatar
LE Manh Cuong committed
19
    mv ~/.zshrc ~/"${ZSHRC_SAVE}";
20
21
22
23
  fi

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

LE Manh Cuong's avatar
LE Manh Cuong committed
24
  . ~/.zshrc;
Robby Russell's avatar
Robby Russell committed
25
else
LE Manh Cuong's avatar
LE Manh Cuong committed
26
  if hash chsh >/dev/null 2>&1; then
27
28
29
30
31
    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
32
33
fi

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