Re: defines varname { [values]... } prog...

From: Emanuele Torre <torreemanuele6_at_gmail.com>
Date: Fri, 24 May 2024 14:27:59 +0200

On Fri, May 24, 2024 at 02:17:23PM +0200, Emanuele Torre wrote:
> On Fri, May 24, 2024 at 08:57:27AM +0000, Laurent Bercot wrote:
> > Your example with backtick doesn't work because backtick is not a
> > substitution command, but let's assume you wanted "importas foo BAR"
>
> I am sorry, yes.
>
> elglob cfiles *.c
> foreground { cmdA argA $cfiles }
> backtick FOO { bar }
> multisubstitute {
> defines newcfiles { $cfiles }
> importas -i foo FOO
> }
> cmdB argB $foo $cfiles
>
> > instead; and your use of "cmdA argA $cfiles" followed by the rest
> > of the script is sketchy, because if cmdA takes a variable number of
> > arguments, it would also take the whole rest of the script, so let's
> > put it in a foreground block.
> >
> > So you would have something like:
> >
> > multisubstitute
> > {
> > elglob cfiles *.c
> > importas -i foo BAR
> > }
> > foreground { cmdA argA $cfiles }
> > cmbB argB $foo $cfiles
> >
> > and there will be no problem in the expansion of $foo either.
> >
>
> But that is wrong; you are assuming that cmdA does not create/deletes
> files; I don't think it is that unreasonable to want to use the same
> list of files for two commands instead of expanding *.c twice that
> results in different values.

Or more relevant to your suggestion, it would have been to say that bar
may depend on files generated by cmdA.

o/
 emanuele6
Received on Fri May 24 2024 - 14:27:59 CEST

This archive was generated by hypermail 2.4.0 : Fri May 24 2024 - 14:28:30 CEST