uninstall.sh 956 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
  echo "Found ~/.zshrc.pre-oh-my-zsh -- Restoring to ~/.zshrc";

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

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

LE Manh Cuong's avatar
LE Manh Cuong committed
28
  . ~/.zshrc;
Robby Russell's avatar
Robby Russell committed
29
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."