[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: $${a,b} brace expansion flaw.
From: |
Chet Ramey |
Subject: |
Re: $${a,b} brace expansion flaw. |
Date: |
Sun, 21 Jan 2024 14:50:12 -0500 |
User-agent: |
Mozilla Thunderbird |
On 1/20/24 2:43 AM, Kaz Kylheku wrote:
Someone just posted this finding on Stackoverflow:
https://stackoverflow.com/questions/77850130/bash-parse-of-x-y
When brace expansion is adjacent to $$, it doesn't expand.
Brace expansion doesn't really understand much shell syntax, and just does
the minimum to avoid conflicts with word expansions. It knows that ${
doesn't introduce a brace expansion, and doesn't care about what precedes
the dollar sign.
It has a simple understanding of quoted strings and backslash quoting by
default. So when compiling for the shell, it treats ${ like \{.
When built as part of the shell, it is able to skip over command
substitutions so brace expansion is deferred until the subshell.
When we wrote it, back in the day, we had the (mostly unrealized) goal of
being able to drop it into other applications that wanted to do brace
expansion. If you want to see the shell-specific parts, look for the
#ifdef SHELL portions in braces.c.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature
- Re: $${a,b} brace expansion flaw., (continued)
- Re: $${a,b} brace expansion flaw., Chet Ramey, 2024/01/21
- Message not available
- Message not available
- Re: $${a,b} brace expansion flaw., Paxsali, 2024/01/20
- Re: $${a,b} brace expansion flaw., Kaz Kylheku, 2024/01/20
- Re: $${a,b} brace expansion flaw., Greg Wooledge, 2024/01/20
- Re: $${a,b} brace expansion flaw., alex xmb sw ratchev, 2024/01/20
- Re: $${a,b} brace expansion flaw., Greg Wooledge, 2024/01/20
- Re: $${a,b} brace expansion flaw., alex xmb sw ratchev, 2024/01/20
- Re: $${a,b} brace expansion flaw., Dennis Williamson, 2024/01/20
- Re: $${a,b} brace expansion flaw., alex xmb sw ratchev, 2024/01/21
- Re: $${a,b} brace expansion flaw., Paxsali, 2024/01/21
Re: $${a,b} brace expansion flaw.,
Chet Ramey <=