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

List:       busybox
Subject:    Re: Strange behaviour/bug in ash Variable substitution
From:       Ralf Friedl <Ralf.Friedl () online ! de>
Date:       2010-06-29 12:36:35
Message-ID: 4C29E8D3.90701 () online ! de
[Download RAW message or body]

Denys Vlasenko wrote:
> On Saturday 26 June 2010 16:12, Ralf Friedl wrote:
>   
>> I have the following effect with this script:
>>
>> $ cat /tmp/test.sh
>> #!/bin/sh
>>
>> IP=192.168.0.1
>> echo "${IP//./\\.}"
>> echo "${IP//./\\.}"' '
>> echo "${IP//./\\.}"'['
>> echo "${IP//./\\.}["
>> echo "${IP//./\\\\.}["
>> # end
>>
>> $ ash /tmp/test.sh
>> 192\.168\.0\.1
>> 192\.168\.0\.1
>> 192.168.0.1[
>> 192.168.0.1[
>> 192\.168\.0\.1[
>> $ bash /tmp/test.sh
>> 192\.168\.0\.1
>> 192\.168\.0\.1
>> 192\.168\.0\.1[
>> 192\.168\.0\.1[
>> 192\\.168\\.0\\.1[
>>
>> The intent is to build a regular expression that has the dots quoted. It 
>> works when nothing follows the substitution (1. echo). It works when 
>> followed by a quoted space, or every other character I tried (2. echo). 
>> The quote doesn't appear when it is followed by an opening bracket, 
>> either in single quotes or in double quotes (3. echo and 4. echo). It 
>> seems that in this case extra backslashes are needed (5. echo). The 
>> substitution is performed, but the following bracket somehow causes an 
>> extra unquoting of the argument.
>> The results with bash are different.
>> BusyBox is v1.16.1.
>>     
> Please try attached patch.
>   
The patch is working, thank you.

Ralf
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

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