patch openwrt to avoid “bad substitution”

when editing some configration of openwrt , this error maybe occured:
/sbin/ifup: eval: line 1: syntax error: bad substitution

I found at least one reason of this error code, and fixed it.

--- /rom/lib/network/config.sh
+++ config.sh
@@ -15,7 +15,7 @@
 
        local fam
        for fam in ipv4 ipv6; do
-               if [ -d /proc/sys/net/$fam ]; then
+               if ls /proc/sys/net/$fam/*/$ifn 2>/dev/null ; then
                        local key
                        for key in /proc/sys/net/$fam/*/$ifn/*; do
                                local val

If there is no such file , $key is “/proc/sys/net/ipv4/*/eth1:1/*” before this modification, statements in then case are not executed after modification. so this code resolved the problem of reporting:
/sbin/ifup: eval: line 1: syntax error: bad substitution

此条目发表在linux分类目录,贴了标签。将固定链接加入收藏夹。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

*