mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-27 15:30:15 +08:00
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
This commit is contained in:
parent
7b73c9ca1c
commit
4deafdff96
@ -25,18 +25,14 @@ if [ -e "$ZSHRC_ORIG" ]; then
|
|||||||
echo "Your original zsh config was restored."
|
echo "Your original zsh config was restored."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if hash chsh >/dev/null 2>&1; then
|
if hash chsh >/dev/null 2>&1 && [ -f ~/.shell.pre-oh-my-zsh ]; then
|
||||||
if [ -f ~/.shell.pre-oh-my-zsh ]; then
|
old_shell=$(cat ~/.shell.pre-oh-my-zsh)
|
||||||
old_shell=$(cat ~/.shell.pre-oh-my-zsh)
|
|
||||||
else
|
|
||||||
old_shell=/bin/bash
|
|
||||||
fi
|
|
||||||
echo "Switching your shell back to '$old_shell':"
|
echo "Switching your shell back to '$old_shell':"
|
||||||
if chsh -s "$old_shell"; then
|
if chsh -s "$old_shell"; then
|
||||||
rm -f ~/.shell.pre-oh-my-zsh
|
rm -f ~/.shell.pre-oh-my-zsh
|
||||||
else
|
else
|
||||||
echo "Could not change default shell. Change it manually by running chsh"
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user