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