patch openwrt to avoid “bad substitution”

十一 13th, 2011

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

标签:
  1. Ashley Winston
    十一 16th, 201109:15

    I like the way you make your blog posts. Keep up the good work and may you gain success in this article writer … Thanks !!!

  2. Faith
    十一 23rd, 201109:04

    That was a cool modification where it could take a good thing to identifies well the syntax error. Thanks for providing it a code of it.

  3. Dawna W. Colvard
    十一 23rd, 201109:15

    Awesome i recently built mine and i was looking for some design ideas and idea of your website ..Thanks!!

  4. Beth A. Forrest
    十一 23rd, 201109:29

    Good source codes you have in here. that can be a big help to people who need hat codes in the future.I am looking forward to see your new blog post.

  5. Jasmine
    十一 23rd, 201110:42

    I am not familiar with these code but I am willing to learn about this. This is new to me, a new learning and a new field. Thanks for sharing.

  6. Tara T. Harris
    十一 23rd, 201114:48

    The great fresh posts keep me coming back here time and time again. thanks again so much.

  7. Ajrin
    十二 13th, 201117:51

    The blog is quite amazing and wonderful and will really help, an originality found in this blog which tells that how mechure is that.

    african mango

*