From d985a821b93fc827b16a01ce7459a868e5f47eea Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Thu, 25 Jan 2024 02:13:04 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9`zsh`=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/init.sh b/scripts/init.sh index a86da9d..ee27862 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -215,7 +215,7 @@ if [ -n "$profile" ];then echo "export CRASHDIR=\"$CRASHDIR\"" >> $profile #设置路径环境变量 source $profile &>/dev/null || echo 运行错误!请使用bash而不是dash运行安装命令!!! #适配zsh环境变量 - [ -n "$(ls -l /bin/sh|grep -oE 'zsh')" ] && [ -z "$(cat ~/.zshrc 2>/dev/null|grep CRASHDIR)" ] && { + [ -n "$(cat /etc/shells|grep -oE 'zsh')" ] && [ -z "$(cat ~/.zshrc 2>/dev/null|grep CRASHDIR)" ] && { echo "alias crash=\"$shtype $CRASHDIR/menu.sh\"" >> ~/.zshrc echo "export CRASHDIR=\"$CRASHDIR\"" >> ~/.zshrc source ~/.zshrc &>/dev/null From ca43babe068a6a1f3abfa89974ff58c79a6b1603 Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Thu, 25 Jan 2024 12:42:23 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=BF=BD=E7=95=A5=20`cat=20/etc/shells`=20?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/init.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/init.sh b/scripts/init.sh index ee27862..baaaedd 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -215,8 +215,10 @@ if [ -n "$profile" ];then echo "export CRASHDIR=\"$CRASHDIR\"" >> $profile #设置路径环境变量 source $profile &>/dev/null || echo 运行错误!请使用bash而不是dash运行安装命令!!! #适配zsh环境变量 - [ -n "$(cat /etc/shells|grep -oE 'zsh')" ] && [ -z "$(cat ~/.zshrc 2>/dev/null|grep CRASHDIR)" ] && { - echo "alias crash=\"$shtype $CRASHDIR/menu.sh\"" >> ~/.zshrc + [ -n "$(cat /etc/shells 2>/dev/null|grep -oE 'zsh')" ] && [ -z "$(cat ~/.zshrc 2>/dev/null|grep CRASHDIR)" ] && { + sed -i '/alias crash=*/'d ~/.zshrc + echo "alias crash=\"$shtype $CRASHDIR/menu.sh\"" >> ~/.zshrc + sed -i '/export CRASHDIR=*/'d ~/.zshrc echo "export CRASHDIR=\"$CRASHDIR\"" >> ~/.zshrc source ~/.zshrc &>/dev/null } From a7c1dbe68ddc0f910c2fdd5a10017a04d3f3683e Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Thu, 25 Jan 2024 12:48:51 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=85=BC=E5=AE=B9=20`clash`=20=E5=91=BD?= =?UTF-8?q?=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/init.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/init.sh b/scripts/init.sh index baaaedd..69f92cb 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -217,7 +217,10 @@ if [ -n "$profile" ];then #适配zsh环境变量 [ -n "$(cat /etc/shells 2>/dev/null|grep -oE 'zsh')" ] && [ -z "$(cat ~/.zshrc 2>/dev/null|grep CRASHDIR)" ] && { sed -i '/alias crash=*/'d ~/.zshrc - echo "alias crash=\"$shtype $CRASHDIR/menu.sh\"" >> ~/.zshrc + echo "alias crash=\"$shtype $CRASHDIR/menu.sh\"" >> ~/.zshrc + # 兼容 clash 命令 + sed -i '/alias clash=*/'d ~/.zshrc + echo "alias clash=\"$shtype $CRASHDIR/menu.sh\"" >> ~/.zshrc sed -i '/export CRASHDIR=*/'d ~/.zshrc echo "export CRASHDIR=\"$CRASHDIR\"" >> ~/.zshrc source ~/.zshrc &>/dev/null