zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Ray Andrews <rayandrews@eastlink.ca>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: xargs with zsh function
Date: Tue, 19 Jan 2021 13:39:17 -0800	[thread overview]
Message-ID: <CAH+w=7bFZpTWJkJ4RSkx2hg11Dxj-fQV1Wvt6EcN7bQKtxmJnA@mail.gmail.com> (raw)
In-Reply-To: <161abccc-2323-8f22-70f9-f5edf59a61e7@eastlink.ca>

On Tue, Jan 19, 2021 at 12:27 PM Ray Andrews <rayandrews@eastlink.ca> 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.


  reply	other threads:[~2021-01-19 21:40 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-17 23:12 Ray Andrews
2021-01-18  3:10 ` Bart Schaefer
2021-01-18 22:14   ` Ray Andrews
2021-01-18 23:09     ` Bart Schaefer
2021-01-19  5:18       ` Ray Andrews
2021-01-19 14:30         ` Ray Andrews
2021-01-19 17:52           ` Lawrence Velázquez
2021-01-19 20:27             ` Ray Andrews
2021-01-19 21:39               ` Bart Schaefer [this message]
2021-01-19 23:48                 ` Ray Andrews
2021-01-20  1:05                 ` Ray Andrews
2021-01-20 18:25                   ` Ray Andrews
2021-01-21  5:52                     ` Bart Schaefer
2021-01-21 19:55                       ` Ray Andrews
2021-01-21 21:50                         ` Bart Schaefer
2021-01-21 23:20                           ` Ray Andrews
2021-01-19 20:31             ` Bart Schaefer
2021-01-19 20:59               ` Ray Andrews
2021-01-20 16:27   ` Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7bFZpTWJkJ4RSkx2hg11Dxj-fQV1Wvt6EcN7bQKtxmJnA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).