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: alex xmb sw ratchev
Subject: Re: $${a,b} brace expansion flaw.
Date: Sun, 21 Jan 2024 20:58:56 +0100

On Sun, Jan 21, 2024, 20:50 Chet Ramey <chet.ramey@case.edu> wrote:

> 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.
>

u d just need wrapper front end or lib for this

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/
>
>


reply via email to

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