From cb732fd3d7c46b7abdac3cb9643d7abb618e0a03 Mon Sep 17 00:00:00 2001 From: juewuy Date: Wed, 23 Jun 2021 02:07:57 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E6=9F=90=E4=BA=9B=E8=BE=A3?= =?UTF-8?q?=E9=B8=A1=E6=9C=BA=E5=9C=BA=E7=9A=84=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/start.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index 5d48267..d04a396 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -259,12 +259,13 @@ EOF #插入自定义规则 sed -i "/#自定义规则/d" $tmpdir/config.yaml if [ -f $clashdir/rules.yaml ];then - echo >> $clashdir/rules.yaml + sed -i '/^$/d' $clashdir/rules.yaml && echo >> $clashdir/rules.yaml #处理换行 + space=$(sed -n '/^rules/{n;p}' $tmpdir/proxy.yaml | grep -oE '^\ *') #获取空格数 while read line;do [ -z "$(echo "$line " | grep '#')" ] && \ [ -n "$(echo "$line" | grep '\-\ ')" ] && \ line=$(echo "$line" | sed 's#/#\\/#') && \ - sed -i "/^rules:/a\ $line #自定义规则" $tmpdir/config.yaml + sed -i "/^rules:/a\\$space$line #自定义规则" $tmpdir/config.yaml done < $clashdir/rules.yaml fi #如果没有使用小闪存模式