[Top][All Lists]

[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: Gecko/20060909 Thunderbird/ Mnenhy/

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.

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

        Also this seems to be strange:

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

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

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.

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

reply via email to

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