From fc5dc18348f617fa83b8996cc055a5aea84f4c6f Mon Sep 17 00:00:00 2001 From: juewuy Date: Mon, 12 Oct 2020 17:17:30 +0800 Subject: [PATCH] =?UTF-8?q?v1.0.0beta14fix4=20~=E4=BF=AE=E5=A4=8D=E9=83=A8?= =?UTF-8?q?=E5=88=86ssr=E8=8A=82=E7=82=B9=E4=B8=8D=E5=8F=AF=E7=94=A8?= =?UTF-8?q?=E7=9A=84bug=20~mac=E8=BF=87=E6=BB=A4=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A7=BB=E9=99=A4=E5=8D=95=E4=B8=AA=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E4=BB=A5=E5=8F=8A=E6=B7=BB=E5=8A=A0=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=8A=9F=E8=83=BD=20~=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=9C=AC=E6=9C=BA=E4=BB=A3=E7=90=86=E6=97=B6?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E8=B7=B3=E5=87=BA=E7=9A=84bug=20~=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=AE=89=E8=A3=85=E8=84=9A=E6=9C=AC=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0root=E7=94=A8=E6=88=B7=E6=A3=80=E6=B5=8B=20~=E4=BC=98?= =?UTF-8?q?=E5=8C=96ipv6dns=E6=8B=A6=E6=88=AA=E6=96=B9=E5=BC=8F=20~?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E8=AE=BE=E5=A4=87=E5=BC=80?= =?UTF-8?q?=E6=9C=BA=E5=90=AF=E5=8A=A8=E6=98=BE=E7=A4=BA=E4=B8=8D=E6=AD=A3?= =?UTF-8?q?=E5=B8=B8=E7=9A=84bug=20~=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=97=B6=E9=97=B4=E6=98=BE=E7=A4=BA=E4=B8=8D?= =?UTF-8?q?=E6=AD=A3=E5=B8=B8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/clash.sh | 13 +++++++------ scripts/getdate.sh | 6 +++--- scripts/start.sh | 6 +++--- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/scripts/clash.sh b/scripts/clash.sh index 52c5698..fcc7cc6 100644 --- a/scripts/clash.sh +++ b/scripts/clash.sh @@ -22,7 +22,7 @@ source $ccfg [ ! -f $clashdir/mac ] && touch $clashdir/mac #开机自启相关 if [ -f /etc/rc.common ];then - if [ -f /etc/rc.d/*clash ];then + if [ -n "$(find /etc/rc.d -name '*clash')" ];then autostart=enable_rc else autostart=disable_rc @@ -62,12 +62,13 @@ if [ -n "$PID" ];then VmRSS=`cat /proc/$PID/status|grep -w VmRSS|awk '{print $2,$3}'` #获取运行时长 if [ -n "$start_time" ]; then - time=$((`date +%s`-$start_time)) - day=$(($time/86400)) - if [[ $day != 0 ]]; then - day=$day天 - else + time=$(expr `date +%s` - $start_time) + #day=$(($time/86400)) + day=$(expr $time / 86400) + if [ "$day" = "0" ]; then day="" + else + day="$day""天" fi time=`date -u -d @${time} +%H小时%M分%S秒` fi diff --git a/scripts/getdate.sh b/scripts/getdate.sh index c15d351..824376f 100644 --- a/scripts/getdate.sh +++ b/scripts/getdate.sh @@ -24,7 +24,7 @@ read -p "请输入对应数字 > " num if [ -z "$num" ] || [[ $num -gt 13 ]];then echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ echo -e "\033[31m请输入正确的数字!\033[0m" -elif [[ "$num" = 0 ]];then +elif [[ "$num" = "0" ]];then echo elif [[ $num -le 13 ]];then #将对应标记值写入mark @@ -161,7 +161,7 @@ do echo -e " 0 \033[31m撤销输入\033[0m" echo -e "回车 \033[32m完成输入\033[0m并\033[33m开始导入\033[0m配置文件!" echo ----------------------------------------------- - read -p "请输入第"$i"个链接 > " url + read -p "请输入第${i}个链接 > " url test=$(echo $url | grep "://") url=`echo ${url/\ \(*\)/''}` #删除恶心的超链接内容 url=`echo ${url/*\&url\=/""}` #将clash完整链接还原成单一链接 @@ -173,7 +173,7 @@ do else Url="$Url"\|"$url" fi - i=$(($i+1)) + i=$(expr $i + 1) elif [ -z "$url" ];then [ -n "$Url" ] && linkset elif [[ $url == 0 ]];then diff --git a/scripts/start.sh b/scripts/start.sh index 6f07ca3..e5c382a 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -82,14 +82,14 @@ if [ "$result" != "200" ];then echo -e "\033[32m无法获取配置文件,请检查链接格式以及网络连接状态!\033[0m" exit 1 else - retry=$(($retry + 1)) + retry=$(expr $retry + 1) echo -e "\033[32m尝试使用其他服务器获取配置!\033[0m" echo -e "\033[33m正在尝试第$retry次/共5次!\033[0m" sed -i '/server_link=*/'d $ccfg if [ "$server_link" -ge 5 ]; then server_link=0 fi - server_link=$(($server_link + 1)) + server_link=$(expr $server_link + 1) sed -i "1i\server_link=$server_link" $ccfg Https="" getyaml @@ -172,7 +172,7 @@ fi yaml=$clashdir/config.yaml #预删除需要添加的项目 i=$(grep -n "^proxies:" $clashdir/config.yaml | head -1 | cut -d ":" -f 1) - i=$(($i-1)) + i=$(expr $i - 1) sed -i "1,${i}d" $yaml #添加配置 sed -i "1imixed-port:\ $mix_port" $yaml