[修复] 修复选装逻辑判断反了的问题, 优化zshrc模板增强通用性

This commit is contained in:
寻觅(樊旭东) 2024-01-25 17:41:32 +08:00
parent 92c378b4c5
commit f673c93b6a
2 changed files with 8 additions and 9 deletions

View File

@ -59,9 +59,9 @@ Select_Continue() {
Show 0 "$1((是/否 Yes/No))"
read r
if echo "$r" | grep -Eq "^[是Yy][Ee]?[Ss]?$";then
return 1
else
return 0
else
return 1
fi
}
@ -104,19 +104,18 @@ Install_Zsh() {
# 下载配置
Download_Config() {
# 创建下载文件的临时目录
GreyStart
Show 0 "正在进行插件下载与配置"
# 下载zsh扩展
GreyStart
ohmyzsh_dir=${ROOT_INSTALL}/oh-my-zsh
sudo git clone https://gitcode.com/mirrors/ohmyzsh/ohmyzsh.git ${ohmyzsh_dir}
sudo git clone https://gitcode.com/mirrors/ohmyzsh/ohmyzsh.git ${ohmyzsh_dir} || Show 1 "关键依赖下载失败"
cd ${ohmyzsh_dir}/custom/plugins/
sudo git clone https://gitcode.com/mirrors/zsh-users/zsh-autosuggestions.git
sudo git clone https://gitcode.com/mirrors/zsh-users/zsh-syntax-highlighting.git
# 下载预设配置
config_url=${ROOT_URL}/raw/配置/zshrc
sudo wget -t 3 -q --show-progress -c "${config_url}" || Show 1 "无法下载预设配置(${config_url})"
sed -i "s/export ZSH=\/etc\/oh-my-zsh/export ZSH=$ohmyzsh_dir/" zshrc
sudo sed -i "s:export ZSH=/etc/oh-my-zsh:export ZSH=$ohmyzsh_dir:" zshrc
sudo mv zshrc /etc/skel/.zshrc
cp -v /etc/skel/.zshrc $HOME
ColorReset
@ -126,11 +125,11 @@ Download_Config() {
# 选配
Select_Config(){
if Select_Continue "启动zsh"; then
zsh
exec zsh
Show 2 "zsh启动完成"
fi
if Select_Continue "将Zsh设置为默认命令行"; then
sudo chsh -s /usr/bin/zsh
chsh -s /usr/bin/zsh
Show 2 "已将zsh设置为默认命令行"
fi
}

View File

@ -82,6 +82,6 @@ source $ZSH/oh-my-zsh.sh
export LC_ALL="zh_CN.UTF-8"
# 别名
alias ls='lsd'
# alias ls='lsd'
alias zshconfig="vim ~/.zshrc"