mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-27 03:14:56 +01:00
Merge 0519d37e52 into a7b4c09373
This commit is contained in:
commit
64e42f01fb
1 changed files with 9 additions and 4 deletions
|
|
@ -25,11 +25,11 @@ fi
|
|||
set -e
|
||||
|
||||
CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l)
|
||||
if [ ! $CHECK_ZSH_INSTALLED -ge 1 ]; then
|
||||
CHECK_ZSH_INSTALLED_NON_GLOBALLY=$(which zsh >/dev/null 2>&1; echo $?)
|
||||
if [ ! "$CHECK_ZSH_INSTALLED" -ge 1 ] && [ ! "$CHECK_ZSH_INSTALLED_NON_GLOBALLY" -eq 0 ]; then
|
||||
printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n"
|
||||
exit
|
||||
fi
|
||||
unset CHECK_ZSH_INSTALLED
|
||||
|
||||
if [ ! -n "$ZSH" ]; then
|
||||
ZSH=~/.oh-my-zsh
|
||||
|
|
@ -89,10 +89,15 @@ mv -f ~/.zshrc-omztemp ~/.zshrc
|
|||
# If this user's login shell is not already "zsh", attempt to switch.
|
||||
TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
|
||||
if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
|
||||
# If this platform provides a "chsh" command (not Cygwin), do it, man!
|
||||
if hash chsh >/dev/null 2>&1; then
|
||||
# If this platform provides a "chsh" command (not Cygwin) and ZSH is installed
|
||||
# globally, do it, man!
|
||||
if hash chsh >/dev/null 2>&1 && [ "$CHECK_ZSH_INSTALLED" -ge 1 ]; then
|
||||
printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n"
|
||||
chsh -s $(grep /zsh$ /etc/shells | tail -1)
|
||||
# If ZSH only installed non-globally.
|
||||
elif [ "$CHECK_ZSH_INSTALLED_NON_GLOBALLY" -eq 0 ] && [ ! "$CHECK_ZSH_INSTALLED" -ge 1 ]; then
|
||||
printf "I can't change your shell automatically.\n"
|
||||
printf "${BLUE}You need to start ZSH in your preferred way every time!${NORMAL}\n"
|
||||
# Else, suggest the user do so manually.
|
||||
else
|
||||
printf "I can't change your shell automatically because this system does not have chsh.\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue