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 21:06:11 +0100

On Fri, Feb 4, 2022 at 8:56 PM Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com> wrote:
>
> On Fri, Feb 4, 2022 at 8:28 PM Chet Ramey <chet.ramey@case.edu> wrote:
> >
> > On 2/4/22 2:23 PM, Alex fxmbsw7 Ratchev wrote:
> >
> > >      > 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
> >
> > Well, you'd certainly have something here if your shell did that. It
> > wouldn't be a POSIX shell, though.
>
> it was my mind shell
>
> does it mean it wont ever get to be the regex /<<([^ \t\f\v\r\n;]+)
>
> that is, after << is parsed a read word till next space, no shell expansion
> logic of separated functional structures in the topic of flat data is
> overruling, you are overseeing

the data functional topic here would be alike 'data has to be parsed,
as simple as possible, till eof marker is reached'
now changing this to dynamic eof marker ( not like it would recognize
not dynamic already so ) beyond
would be easily nested ( in eval or so ) possible, but else invalid in
code parsing
cause eof of such would never maybe be reached
cause its a dynamical $( printf leet_code ) one
in runtime, when parser 'eof me till' ( read till this specific eof )
it would try to read and execute so no ? i dunno if bash does it

example

cat <<$( printf leet )
$(  printf leet )
$( printf leet )
notice the two spaces in the middle to not match eof

or in quotes, in the mode that bash mostly interpretes data

thats valid code, cause eof is written twice ( the $( .. ) code )
but

cat <<$(  printf end )
$( printf end )
# here it should already end the heredoc parser

but bash doesnt eval far enough

so you with dynamical eofs will be eof syntax error no matching heredoc end

you can avoid that by an eval wrapper btw

eo=eof
eval "cat <<$eo
$data
$eo"

maybe .. just thoughts

but atm who can say it made the perfect software , .. =)

greets and sorry for bad english


> for me <<$( e o f )
> blabla
> $( e o f )
>
> is pure early bug
>
> >
> > --
> > ``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]