bug-bash
[Top][All Lists]
Advanced

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

Re: Possible bug for nested curly brace expansion


From: Kaz Kylheku
Subject: Re: Possible bug for nested curly brace expansion
Date: Thu, 06 Mar 2025 18:06:55 -0800
User-agent: Roundcube Webmail/1.4.15

On 2025-03-06 11:58, Lawrence Velázquez wrote:
> On Thu, Mar 6, 2025, at 1:48 PM, microsuxx wrote:
>> {0} is no expansion
>> {0,} is
>> it must be 2+
> 
> And this is documented.  It is not a bug.
> 
>       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.
> 
> https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html

Note that glibc's glob function also allows {abc} to produce abc.

But Bash cannot do this. The reason is that brace expansion is already
a deviation from POSIX.

In POSIX, the {} word has a special role: in the arguments of the
-exec predicate of the find utility, it denotes a character sequence
to be replaced with the path name being visited.

Even if {abc} were to denote abc, {} would continue to have to be a special
case denoting [}.

Or else Bash would need a flag to enable the behavior whereby {abc} is
abc and {} expands to nothing. Scripts turning on that flag would
have to carefully quote {} when using the find utility.





reply via email to

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