bug-bash
[Top][All Lists]
Advanced

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

Re: Curly braces expansion not always works as expected.


From: mwoehlke
Subject: Re: Curly braces expansion not always works as expected.
Date: Fri, 06 Oct 2006 10:08:12 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.0

Stephane Chazelas wrote:
On Thu, Oct 05, 2006 at 12:23:41AM +0200, Reuti wrote:
[...]
Curly braces expansion only works with at least one comma (,). This also works, if the appears at least once
        inside some apostrophes and has no function.

Repeat-By:
        reuti@defiant:~> bash --version
        GNU bash, version 2.05b.0(1)-release (powerpc-apple-darwin8.0)
        Copyright (C) 2002 Free Software Foundation, Inc.
        reuti@defiant:~> echo {"x x"} # No {} in output expected.
        {x x}
        reuti@defiant:~> echo {"xx"} # No {} in output expected.
        {xx}
        reuti@defiant:~> echo {"xx","yy"} # Works fine.
        xx yy
reuti@defiant:~> echo {"x,x"} # Add a comma to get it working, i.e. remove the {}.
        x,x
        reuti@defiant:~>

        Also this seems to be strange:

reuti@defiant:~> echo {"klklkl"} {1,2,3} # Only second {} works correctly.
        {klklkl} 1 2 3
        reuti@defiant:~> echo {"klklkl"}{1,2,3} # Completely messed up.
        {klklkl}{1,2,3}

Only that one is a bug, it should output {klklkl}1 {klklkl}2
{klklkl}3

The other ones work as documented.

From info -f bash -n 'Brace Expansion'

 | A correctly-formed brace expansion must contain unquoted
 | opening and closing braces, and at least one unquoted comma
 | or a valid sequence expression.  Any incorrectly formed brace
 | expansion is left unchanged.

...but doesn't that mean that '{"x,x"}' should expand as '{x,x}', not 'x,x'? Note *unquoted* in the sentence above.

--
Matthew
"What's Cygwin?" you ask.
'Tis mostly absurd software
Concerning hippos.





reply via email to

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