bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: incorrect brace expansion


From: William Park
Subject: Re: incorrect brace expansion
Date: Sun, 29 Jan 2006 20:08:05 -0500
User-agent: Mutt/1.4.2.1i

On Sun, Jan 29, 2006 at 07:33:14PM -0500, Chris F.A. Johnson wrote:
> On Sun, 29 Jan 2006, William Park wrote:
> >Let's see...
> >   a-{b{d,e}}-c
> >   a-{bd,be}-c
> >   a-bd-c a-be-c
> >
> >It looks okey, I think.
> 
>     Except that b{d,e} expands to 'bd be', not 'bd,be'.

Hmm... no.  Internally, {d,e} gets converted to array of 2 strings, ie.
    array[0] = "d";
    array[1] = "e";
Then, prefix and suffix are attached.  So, when prefix 'b' is attached,
you have
    array[0] = "bd";
    array[1] = "be";
This continues recursively (left to right, I believe).

When you attach the second prefix 'a-' and suffix '-c', the results are
    array[0] = "a-bd-c";
    array[1] = "a-be-c";
Now, you can argue that suffix/prefix are 'a-{' and '}-c', in which
case, you get 
    array[0] = "a-{bd}-c";
    array[1] = "a-{be}-c";

I think, it's matter of taste. :-)

-- 
William Park <opengeometry@yahoo.ca>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
           http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
          http://freshmeat.net/projects/bashdiff/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]