no message
parent
9151edaaa4
commit
3ffe33f450
|
@ -17,11 +17,45 @@ install_homebrew() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
install_zsh() {
|
||||||
|
# Check if zsh is already installed
|
||||||
|
if command -v zsh &> /dev/null; then
|
||||||
|
echo "zsh is already installed."
|
||||||
|
else
|
||||||
|
# Check the operating system
|
||||||
|
if [ "$(uname)" == "Darwin" ]; then
|
||||||
|
# macOS specific installation
|
||||||
|
brew install zsh
|
||||||
|
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
|
||||||
|
# Linux specific installation
|
||||||
|
sudo apt-get install zsh # 适用于 Debian/Ubuntu 等
|
||||||
|
# 或者使用其他 Linux 发行版的安装命令
|
||||||
|
else
|
||||||
|
echo "Unsupported operating system. Cannot install zsh."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set zsh as the default shell
|
||||||
|
if [ "$(uname)" == "Darwin" ]; then
|
||||||
|
sudo dscl . -create /Users/$(whoami) UserShell /usr/local/bin/zsh
|
||||||
|
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
|
||||||
|
chsh -s $(which zsh)
|
||||||
|
else
|
||||||
|
echo "Unsupported operating system. Cannot set zsh as default shell."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Zsh installation completed and set as the default shell. Please restart your terminal."
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# install home-brew
|
# install home-brew
|
||||||
install_homebrew
|
install_homebrew
|
||||||
|
|
||||||
|
|
||||||
# install zsh
|
# install zsh
|
||||||
|
install_zsh
|
||||||
|
|
||||||
# install oh-my-zsh
|
# install oh-my-zsh
|
||||||
#git clone https://git.mingzailao.live/mingzailao/ohmyzsh.git ~/.oh-my-zsh
|
#git clone https://git.mingzailao.live/mingzailao/ohmyzsh.git ~/.oh-my-zsh
|
||||||
|
|
Loading…
Reference in New Issue