ppp: syncppp: further fix grep's regex match (#4623)

/etc/config/network这个文件里的写法可以各种各样,pppoe外面可以有引号,也可以没引号。proto与pppoe之间可以有不同类型、不同数量的空格(或Tab)。用uci show,可以把输出格式统一掉,省得考虑配置文件不同写法的区别。
This commit is contained in:
HiGarfield 2020-06-09 16:14:26 +08:00 committed by GitHub
parent bae6e7fc28
commit e0c345df71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -233,8 +233,8 @@ proto_pppoe_setup() {
#By 蝈蝈:并发拨号同步的前期准备
syncppp_option=""
[ "$(uci get syncdial.config.enabled)" == "1" ] && {
ppp_if_cnt=$(cat /etc/config/network | grep -E -c "proto\s+?'pppoe'")
[ "$(uci get syncdial.config.enabled)" -eq "1" ] && {
ppp_if_cnt=$(uci show network | grep -c "\.proto=\'pppoe\'$")
syncppp_option="syncppp $ppp_if_cnt"
shellsync $ppp_if_cnt 10
}