On Fri, Sep 3, 2010 at 2:58 PM, Ralf Friedl <[email protected]> wrote:
> I'm using BusyBox v1.17.2 ash. It seems that it is impossible to replace a
> forward slash in a variable expansion, even if the slash is quoted:
>
> $ busybox ash
> $ VAR=ab/cd; echo ${VAR//[^\/]/}
> ab/cd
> $ VAR='ab/cd'; echo ${VAR//\//}
> ab/cd
> $ VAR='a[^b/cd'; echo ${VAR//[^/]/}
> a[^b/cd
>
> $ bash
> $ VAR=ab/cd; echo ${VAR//[^\/]/}
> /
> $ AR='ab/cd'; echo ${VAR//\//}
> abcd
> $ VAR='a[^b/cd'; echo ${VAR//[^/]/}
> a]/b/cd
>
> The real pattern I want to use is a little more complicated, but the
> difference comes from the slash that works when quoted in bash and doesn't
> work in ash.
> The slash outside of the set also doesn't work.
> The difference in the third pattern is not important for me at the moment,
> but I tried to understand what happens with this pattern. In bash it seems
> the pattern is split at the slash and '[^' is replaced with ']'. Busybox ash
> seems to behave differently.

Unfortunately ${var/pattern/repl} in ash is a bad hack. I looked at it.
It's hard to fix.
-- 
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to