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