Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: protect spaces and/or globs



> On 10 February 2021 at 16:19 Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> On 2021-02-10 7:47 a.m., Peter Stephenson wrote:
> >
> > No eval needed, the arguments are now exactly the correct command arguments.
> >
> If you look at this one case indeed no eval is needed, but in the 
> broader context of the way all
> my functions work, the eval is unavoidable.  Or is it?  Maybe not.

As always, that depends what you're actually doing, which is a superset of
what you're telling us you're doing, but in general it shouldn't be a problem
--- unless you know you need an extra set of expansions, it's possible to
prepare the arguments you need in the array to be executed as a command
line.

What I mean is, the cases where this *wouldn't* work would be like this...

fullargs=(some stuff '$to_be_expanded_later')

So somewhere down the line you're going to assign to to_be_expanded_later,
and you want that to be expanded when you execute the command line.
*Now* you need the extra eval.  But if you're not doing anything like
that, you've just plain old command line arguments and no eval is needed.

pws




Messages sorted by: Reverse Date, Date, Thread, Author