[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [BusyBox] Shell bug, or my snafu?
From:       Charlie Brady <charlieb-busybox () e-smith ! com>
Date:       2004-03-25 16:25:13
Message-ID: Pine.LNX.4.44.0403251114000.23730-100000 () allspice ! nssg ! mitel ! com
[Download RAW message or body]

I'm using busybox 1.00-pre5, linked with uClibc-0.9.19 (mipsel target).

I'm tweaking IFS for "on-the-cheap" parsing of filenames. But IFS seems to 
be being munged inside variable values. If I'm making a dumb mistake, 
please point it out to me. Otherwise I think we have a bug.

Here is the shell source:

   IFS='-'
    ls $tmpRouteDir | while read net mask gw metric
    do
        FILE="$tmpRouteDir/$net-$mask-$gw-$metric"
        if [ ! -f "$FILE" ] ; then
            echo could not find file "$FILE"
            continue
        fi
[snip]
    done

And note when we run the script, '-' in $FILE suddenly becomes space (and
that's space not within a quoted string):

...
+ IFS=-
+ ls /tmp/existing.routes
+ read net mask gw metric
+ FILE=/tmp/existing.routes/192.168.1.0-255.255.255.0-0.0.0.0-0
+ [ ! -f /tmp/existing.routes/192.168.1.0 255.255.255.0 0.0.0.0 0 ]
[: 255.255.255.0: unknown operand
+ [ 0 = 1 ]
+ rm /tmp/existing.routes/192.168.1.0 255.255.255.0 0.0.0.0 0
rm: cannot remove `/tmp/existing.routes/192.168.1.0': No such file or 
directory
rm: cannot remove `255.255.255.0': No such file or directory
rm: cannot remove `0.0.0.0': No such file or directory
rm: cannot remove `0': No such file or directory
+ read net mask gw metric
...

--
Charlie



_______________________________________________
busybox mailing list
busybox@mail.busybox.net
http://codepoet.org/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic