help-bash
[Top][All Lists]
Advanced

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

Re: $${a,b} brace expansion flaw.


From: Lawrence Velázquez
Subject: Re: $${a,b} brace expansion flaw.
Date: Sat, 20 Jan 2024 18:50:21 -0500
User-agent: Cyrus-JMAP/3.9.0-alpha0-1374-gc37f3abe3d-fm-20240102.001-gc37f3abe

On Sat, Jan 20, 2024, at 2:19 PM, Kaz Kylheku wrote:
> On 2024-01-20 08:33, Kaz Kylheku wrote: 
>> (Or maybe it was considered and omitted for some good reasons;
>> I'd have to look at the code: comments, anything in its history
>> or other details.)
>
> There are subtleties. We would like $${a,b} to expand,
> but not \$${a,b}. We have to be sure that the if there are
> two $ before brace expansion, they are both unescaped, so
> that they denote the the PID syntax. The first $ must not be
> part of any other syntax, like $$${a,b}. Given
> $$$$$$$$$${a,b}, if there is an even number of dollar signs,
> we expand {a,b} as brace expansion, otherwise not.
> That's not even considering mixtures of backslashed $
> and plain. $$$\$$$\$$$$$$\$$$$$\$\$$${a,b}. Expand or not?
>
> Hot mess! :)

Indeed.  Small wonder the implementation opted for something simple
and straightforward, especially when the workaround is trivial:

        $ echo "$$"{a,b}
        14899a 14899b

-- 
vq



reply via email to

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