bug-bash
[Top][All Lists]
Advanced

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

Re: Incorrect alias expansion within command substitution


From: Alex fxmbsw7 Ratchev
Subject: Re: Incorrect alias expansion within command substitution
Date: Fri, 4 Feb 2022 20:23:50 +0100

On Fri, Feb 4, 2022, 20:18 Chet Ramey <chet.ramey@case.edu> wrote:

> On 2/3/22 9:46 PM, Alex fxmbsw7 Ratchev wrote:
>
> >     The case I had in question with the question about $( a b ) was this
> >     one...
> >
> >              cat <<$( a b )
> >              hello
> >              $( a b )
> >
> >
> > i think you are mis understanding the differencies here between shell
> > expression parsing, and a rather data only part which applies here
> > that is, <<{word} is a word and is threated as flat text word, in
> further
> > eof recognition, applying advanced expressions here seems me like an
> early bug
>
> It is a WORD (in the POSIX grammar sense), and so recursive parsing and
> alias expansion are required as soon as you hit the `$('. It's what you
> do with the word once you have it that matters.
>
> > imho the example above should have resulted in error ')'
> > it would execute cat a b ) with hello till $( then rather \n and a b )
> > again, useless
> > especially the $( wasnt even quoted
>
> What can this possibly mean? What semantic interpretation would lead you
> to the conclusion that you should stop reading the token after a `$(' in
> this one specific case?
>

by flat non lexical text parsing, excepts for quotes but then $( logically
expands, excepts:
but imho the topic here is how far to expand shell stuff at this position,
however factically its just needs to be a constant data separator

so <<$( would match eof to be $(

simplified logic, i dunno about 'word' in shell grammar with expansion, but
imho for a data separator such eval actment is invalid

> chet didnt you say there were no bugs ? =)
>
> I didn't, but how is that relevant here?
>

excuse me :)

>
> --
> ``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]