Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: xargs with zsh function
On Tue, Jan 19, 2021 at 12:27 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> My strong preference would be that zargs be agnostic as to one's
> environment and functions called by it would behave exactly as
> otherwise.
That's what the zargs_patch.txt in my other message is supposed to do.
> I'd like to be able to link my functions together
> via piping+zargs.
Pipelines are for linking together things that expect to read standard
input and write standard output.
foo | bar
is the same as
foo > file
bar < file
except that the file is being simultaneously written and read, which
means that at least one of foo or bar has to run in the background.
In zsh, that's "foo", in bash it's "bar", and in a true POSIX shell
it's both of them. (A patch to cause zsh to work that last way in
shell emulation was recently posted.)
Functions can be written to read standard input and write standard
output, of course, but often they are intended to do work in the
current shell environment. If you rejigger them into a pipeline, you
force some of them into background subshells, and those are no longer
able to affect the current shell. That may or may not be OK, but you
should think about it.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author