On Friday 13 June 2008 22:54, James Simmons wrote:
>
> On Fri, 13 Jun 2008, Denys Vlasenko wrote:
>
> > On Thursday 12 June 2008 22:59, James Simmons wrote:
> > >
> > > > > Hi!
> > > > >
> > > > > I'm attempting color text but I'm getting "K[37;1mTextK[31;1m".
> > > > > Any
> > > > > idea what is wrong?
> > > >
> > > > What do you do to get it?
> > >
> > > echo "IP address <$ip>"
> >
> > Well, I meant "give me means to reproduce your case" :)
>
> Here you go. In bash the text is:
> Software version: 1.0.0
>
> In ash it prints:
> Software version: K[37;1m1.0.0K[37;0m
>...
Smaller testcase:
a='a<b'
b='\033#'
r=${a//</$b}
echo $r
Results:
# sh zz
a\033#b
# ./busybox ash zz
aK#b
'<' is not special. Replacing 'b' in 'abc' would work the same.
The culprit is '\' in replacement.
BTW: I found out who's the author of ${var//s/r} code in ash. It's... you:
r21481 | vda | 2008-03-25 02:17:40 +0100 | 17 lines
ash: optional bash-like pattern subst and substring opts
(by James Simmons <jsimmons AT infradead.org>)
TODO: write testsuite!
:)
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox