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: Stephane Chazelas
Subject: Re: Curly braces expansion not always works as expected.
Date: Fri, 6 Oct 2006 09:08:26 +0100
User-agent: Mutt/1.5.6i

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:
>         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.
>         {xx}
>         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 {}.
>         x,x
>         address@hidden:~>
> 
>         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.
>         {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.

>         address@hidden:~> echo {"kl,klkl"}{1,2,3} # Add a comma to  
> get it working
>         kl,klkl1 kl,klkl2 kl,klkl3
>         address@hidden:~>
[...]

-- 
St├ęphane




reply via email to

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