diff options
author | Giuseppe <giuscri@gmail.com> | 2019-11-25 16:36:33 +0100 |
---|---|---|
committer | Marc Cornellà <marc.cornella@live.com> | 2019-11-25 16:36:33 +0100 |
commit | 4deafdff962eca8739e321113f5ba338d3990756 (patch) | |
tree | 0e5a73f8def375c88f1066a61463e4c8bf824396 /tools/uninstall.sh | |
parent | 7b73c9ca1ced57cdf545e860e880658753b81777 (diff) | |
download | zsh-4deafdff962eca8739e321113f5ba338d3990756.tar.gz zsh-4deafdff962eca8739e321113f5ba338d3990756.tar.bz2 zsh-4deafdff962eca8739e321113f5ba338d3990756.zip |
Fix change to old shell on uninstall (#8430)
If there's no `~/.shell.pre-oh-my-zsh`, don't assume the default choice
is Bash. In fact Zsh is the default shell for macOS since Catalina
(10.15) [1], yet users of other OSes have likely to have Bash as their
default.
This commit fix issue #8252
[1] https://support.apple.com/en-us/HT208050
Diffstat (limited to 'tools/uninstall.sh')
-rw-r--r-- | tools/uninstall.sh | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/tools/uninstall.sh b/tools/uninstall.sh index da31a6a14..b327a0163 100644 --- a/tools/uninstall.sh +++ b/tools/uninstall.sh @@ -25,18 +25,14 @@ if [ -e "$ZSHRC_ORIG" ]; then echo "Your original zsh config was restored." fi -if hash chsh >/dev/null 2>&1; then - if [ -f ~/.shell.pre-oh-my-zsh ]; then - old_shell=$(cat ~/.shell.pre-oh-my-zsh) - else - old_shell=/bin/bash - fi +if hash chsh >/dev/null 2>&1 && [ -f ~/.shell.pre-oh-my-zsh ]; then + old_shell=$(cat ~/.shell.pre-oh-my-zsh) echo "Switching your shell back to '$old_shell':" if chsh -s "$old_shell"; then rm -f ~/.shell.pre-oh-my-zsh else echo "Could not change default shell. Change it manually by running chsh" - echo "or editing the /etc/passwd file." + echo "or editing the /etc/passwd file." fi fi |