bug-bash
[Top][All Lists]
Advanced

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

Re: incorrect brace expansion


From: Bob Proulx
Subject: Re: incorrect brace expansion
Date: Sat, 28 Jan 2006 14:47:23 -0700
User-agent: Mutt/1.5.9i

Tim Waugh wrote:
>       echo a-{b{d,e}}-c
> 
>       Should get: a-{bd}-c a-{be}-c
>       but actually get: a-bd-c a-be-c

Hmm...  But csh is the origin of the brace expansion feature.  So
shouldn't bash behave like csh?  Which bash does do at this time.

  csh -c 'echo a-{b{d,e}}-c'
  a-bd-c a-be-c
  bash -c 'echo a-{b{d,e}}-c'
  a-bd-c a-be-c

What is the basis for the belief that it should get the other output?

> Original bug report:
>       https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=179081

I think I understand what the original poster was thinking.  Only the
inner set of braces has a comma and the outside set does not so
therefore the outside set should not be expanded.  But that would be
different than historical csh implementation.  So the user was not
taking this from experience with brace expansion.  Reading the
documentation very literally it says that a brace expansion is ... "a
series of comma-separated strings" ... "between a pair of braces".
The outer braces do contain the inner comma-separated strings so csh
is probably justified in the behavior. (shrug)

Bash behaves the same as csh behaves for this feature.  So I don't
think it should be changed.  To turn off brace expansion simply quote
the braces that you want to remain.  "A { or , may be quoted with a
backslash to prevent its being considered part of a brace expression."

  csh -c 'echo a-\{b{d,e}}-c'
  a-{bd}-c a-{be}-c

Bob

Attachment: signature.asc
Description: Digital signature


reply via email to

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