diff --git a/scripts/clash.sh b/scripts/clash.sh index 49465b4..922d3fe 100644 --- a/scripts/clash.sh +++ b/scripts/clash.sh @@ -93,7 +93,7 @@ getconfig(){ setconfig(){ #参数1代表变量名,参数2代表变量值,参数3即文件路径 [ -z "$3" ] && configpath=$clashdir/mark || configpath=$3 - [ -n "$(grep ${1}= $configpath)" ] && sed -i "s#${1}=\(.*\)#${1}=${2}#g" $configpath || echo "${1}=${2}" >> $configpath + [ -n "$(grep -E "^${1}=" $configpath)" ] && sed -i "s#^${1}=\(.*\)#${1}=${2}#g" $configpath || echo "${1}=${2}" >> $configpath } #启动相关 errornum(){