From 8dc3c3fdc2003eed3304d3451ae19a6f73cb2dd1 Mon Sep 17 00:00:00 2001 From: juewuy Date: Wed, 14 Oct 2020 09:12:23 +0800 Subject: [PATCH] =?UTF-8?q?v1.0.0beta14fix5=20~=E4=BC=98=E5=8C=96=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E4=BF=9D=E5=AD=98=E6=96=B9=E5=BC=8F=EF=BC=8C=E7=8E=B0?= =?UTF-8?q?=E5=9C=A8=E6=AF=8F10=E5=88=86=E9=92=9F=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=EF=BC=8C=E4=BB=85=E5=9C=A8=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E5=88=B0=E6=96=87=E4=BB=B6=E5=8F=98=E5=8A=A8=E5=90=8E=E6=96=B9?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=BF=9D=E5=AD=98=20~=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=83=A8=E5=88=86ssr=E8=8A=82=E7=82=B9=E4=B8=8D=E5=8F=AF?= =?UTF-8?q?=E7=94=A8=E7=9A=84bug=20~mac=E8=BF=87=E6=BB=A4=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E5=A2=9E=E5=8A=A0=E7=A7=BB=E9=99=A4=E5=8D=95=E4=B8=AA?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E4=BB=A5=E5=8F=8A=E6=B7=BB=E5=8A=A0=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E8=AE=BE=E5=A4=87=E5=8A=9F=E8=83=BD=20~=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E8=AE=BE=E7=BD=AE=E6=9C=AC=E6=9C=BA=E4=BB=A3=E7=90=86?= =?UTF-8?q?=E6=97=B6=E7=9B=B4=E6=8E=A5=E8=B7=B3=E5=87=BA=E7=9A=84bug=20~?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AE=89=E8=A3=85=E8=84=9A=E6=9C=AC=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0root=E7=94=A8=E6=88=B7=E6=A3=80=E6=B5=8B=20~?= =?UTF-8?q?=E4=BC=98=E5=8C=96ipv6dns=E6=8B=A6=E6=88=AA=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=20~=E5=9B=9E=E6=BB=9A=E5=AF=B9=E5=BE=AA=E7=8E=AF=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E7=9A=84=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/clash.sh | 8 ++++---- scripts/getdate.sh | 2 +- scripts/start.sh | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/clash.sh b/scripts/clash.sh index fcc7cc6..cf7e27e 100644 --- a/scripts/clash.sh +++ b/scripts/clash.sh @@ -62,9 +62,9 @@ if [ -n "$PID" ];then VmRSS=`cat /proc/$PID/status|grep -w VmRSS|awk '{print $2,$3}'` #获取运行时长 if [ -n "$start_time" ]; then - time=$(expr `date +%s` - $start_time) - #day=$(($time/86400)) - day=$(expr $time / 86400) + time=$((`date +%s`-start_time)) + day=$((time/86400)) + #day=$(expr $time / 86400) if [ "$day" = "0" ]; then day="" else @@ -386,7 +386,7 @@ macfilter(){ i=1 for mac in $(cat $clashdir/mac); do echo -e " $i \033[32m$(cat /tmp/dhcp.leases | awk '{print $3,$2,$4}' | grep $mac)\033[0m" - i=$(expr $i + 1) + i=$((i+1)) done echo ----------------------------------------------- echo -e "\033[0m 0 或回车 结束删除" diff --git a/scripts/getdate.sh b/scripts/getdate.sh index 824376f..8d70989 100644 --- a/scripts/getdate.sh +++ b/scripts/getdate.sh @@ -173,7 +173,7 @@ do else Url="$Url"\|"$url" fi - i=$(expr $i + 1) + i=$((i+1)) elif [ -z "$url" ];then [ -n "$Url" ] && linkset elif [[ $url == 0 ]];then diff --git a/scripts/start.sh b/scripts/start.sh index 3cc67c9..9ff9147 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=$(expr $retry + 1) + retry=$((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=$(expr $server_link + 1) + server_link=$((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=$(expr $i - 1) + i=$((i-1)) sed -i "1,${i}d" $yaml #添加配置 sed -i "1imixed-port:\ $mix_port" $yaml @@ -217,7 +217,7 @@ start_redir(){ iptables -t nat -A clash -p tcp $ports-j REDIRECT --to-ports $redir_port iptables -t nat -A PREROUTING -p tcp -j clash #设置ipv6转发 - if [ "$ipv6_support" = "已开启" ];then + if [ -n "ip6_nat" -a "$ipv6_support" = "已开启" ];then ip6tables -t nat -N clashv6 for mac in $(cat $clashdir/mac); do ip6tables -t nat -A clashv6 -m mac --mac-source $mac -j RETURN @@ -264,8 +264,8 @@ start_dns(){ iptables -t nat -I PREROUTING -p tcp -d 8.8.8.8 -j clash_dns iptables -t nat -I PREROUTING -p tcp -d 8.8.4.4 -j clash_dns #ipv6DNS - ip6_nat=$(ip6tables -t nat -L 2>&1|grep -o 'not exist') - if [ -z "ip6_nat" ];then + ip6_nat=$(ip6tables -t nat -L 2>&1|grep -o 'Chain') + if [ -n "ip6_nat" ];then ip6tables -t nat -N clashv6_dns > /dev/null 2>&1 for mac in $(cat $clashdir/mac); do ip6tables -t nat -A clashv6_dns -m mac --mac-source $mac -j RETURN > /dev/null 2>&1