mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-03 04:20:01 +02: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
|
set -e
|
||||||
|
|
||||||
CHECK_ZSH_INSTALLED=$(grep /zsh$ /etc/shells | wc -l)
|
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"
|
printf "${YELLOW}Zsh is not installed!${NORMAL} Please install zsh first!\n"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
unset CHECK_ZSH_INSTALLED
|
|
||||||
|
|
||||||
if [ ! -n "$ZSH" ]; then
|
if [ ! -n "$ZSH" ]; then
|
||||||
ZSH=~/.oh-my-zsh
|
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.
|
# If this user's login shell is not already "zsh", attempt to switch.
|
||||||
TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
|
TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
|
||||||
if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
|
if [ "$TEST_CURRENT_SHELL" != "zsh" ]; then
|
||||||
# If this platform provides a "chsh" command (not Cygwin), do it, man!
|
# If this platform provides a "chsh" command (not Cygwin) and ZSH is installed
|
||||||
if hash chsh >/dev/null 2>&1; then
|
# 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"
|
printf "${BLUE}Time to change your default shell to zsh!${NORMAL}\n"
|
||||||
chsh -s $(grep /zsh$ /etc/shells | tail -1)
|
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, suggest the user do so manually.
|
||||||
else
|
else
|
||||||
printf "I can't change your shell automatically because this system does not have chsh.\n"
|
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