Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: xargs with zsh function
On Thu, Jan 21, 2021 at 11:56 AM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> On 2021-01-20 9:52 p.m., Bart Schaefer wrote:
> >
> > Since Ray asked: Apply this with
> > patch -p1 Functions/Misc/zargs < zargs_patch2.txt
> Seems to pass my posted test with flying colors. One thing tho, the
> paths: My working 'zargs' is:
>
> ..../Zsh-5.8/share/zsh/5.8/functions/zargs
>
> I have no directory 'Functions' or 'Misc' anywhere on my system. How is
> it that my zsh directory tree is different?
My instruction was for patching the zsh source tree, not an installed location.
> BTW, speaking of passing data from one function to another supposing we
> have a list of filenames in a file:
>
> ... how can the contents of the file be fed to 'ls' as one call, but
> with the spaces protected?
That should "just work". You don't usually even need zargs for that:
% ls -dl -- ${(f)"$(<filenames.txt)"}
The reason zargs exists is in case the above "ls" complains "argument
list too long". In that case you can do
% zargs -- ${(f)"$(<filenames.txt)"} -- ls -dl
to break up the argument list into slices that "ls" will accept.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author