From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 19403 invoked from network); 19 Jan 2021 21:40:01 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 19 Jan 2021 21:40:01 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1611092401; b=cF1VMgQhsKHYre12bYtvj1ec3MkGZ9PhzDZz82EuXFHwp9BuAHfGT+F0oddaLEfc9OveFQvVLm YWQ1BtEoAG2SSkyU/5AlyWxF6Nxz08rzrrZ++LWBtINK1JFtSDZ8X6ZHurWtLaGwhaNojeUAEd f62uu7WWNu0YO4DoCqkQNIC2LJz4OWNxKpM4XV4F8103ZanOFs/xHtulFwTk2ipWs+bra81Fh5 gUIuNu3FQq4GyKwYT+Zbuuq7gAaJgdvRCiXR3r9wSQ+k5SLN9nhKZ4aBEATOJC4MInn0Ivrfb4 wrbCPxAC7JyTk0eFh8mEb5GrtufRlPUc8aBUVotC9o21Rg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-oi1-f178.google.com) smtp.remote-ip=209.85.167.178; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1611092401; bh=aekN+zGfWuJXKtpgIkLWlzOj4TVgheEeTsecd4jxckU=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=uyZPfnsE84rhZ1571041Lokz8FE6CoZt9tT7LNbuSbt59ePOi9klmjJuDgJAOmwJIf2avcGxcv QOzzBBYJ5BXO7QUn+ykuQy5JeZtSEDg0GuqONbzDQDePR0SxOZc0iVTjzDlCaVY3qAZC0LaLwt GXHa8IA8v9pkiDk4PTLswyyO558Du79Np8QH7EUMnkOA/s7BATKeWetMpC0nbWmak1kb4v89ix Hy3hNDizqeAmGGdZsYrIA/lleddvdzHC2crKPofP1CwTy5DwJEL8f5tyE4pZLAMX0cc8kgxs9z +iESVNYsDYC/8Gu3BF5n+vEUgxqsU0RkkQeCv7SDqXQCJg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=mJH7gOdrMMGyFQ8LKTWhVkjGeJHdHILx+XSnBNhOxgI=; b=Y2BmVRnGzs+8IlmJr4vUisesSP Lg/nNpLmwXFBv/yA5IvKvmrWNzeT8T35YqA8/3uhxqB7dHiW/OVe0WWDTtKPX6rKnSr/wJK1dHwTf KtmFhXH9cidhYGx+ugUnIfi8PmLoyheUXJ3galEl8p3+FZJ8tCUnHqPQAI6nktOHypKzfO+tw/uUg dq5uUbNMFZwayz11ZOcyRi8jnjO0sGUdxY9SaauxdJ6sGgGNpgJRbnzvWgOuh4mNU/YGlRXRFAJfa EBaOnP0aFTWm8KVVyDMEyWqYNPGaSpAyHXgEo3ORC3VrPOVX3DVD3caUvk6sDV9SzkFo6AylKtKOE +2qFkzFg==; Received: from authenticated user by zero.zsh.org with local id 1l1yjI-000B15-FA; Tue, 19 Jan 2021 21:40:00 +0000 Authentication-Results: zsh.org; iprev=pass (mail-oi1-f178.google.com) smtp.remote-ip=209.85.167.178; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-oi1-f178.google.com ([209.85.167.178]:44545) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1l1yio-000AdB-0x; Tue, 19 Jan 2021 21:39:30 +0000 Received: by mail-oi1-f178.google.com with SMTP id d189so22824383oig.11 for ; Tue, 19 Jan 2021 13:39:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mJH7gOdrMMGyFQ8LKTWhVkjGeJHdHILx+XSnBNhOxgI=; b=oD/0N2sav8l+qJzA7T2svT6mJlFY6LT2BTdpf1CYg0H2ycKz+Zwxp8fJKR+DH2O1SO mWeXdEhfD61i9dDj681r4cX2tlcqUyR1LlhEBx+58OeWRIjVCwDC7MZ9NsCkF4oaPzvP BDMkJvwtvuMrxUT3ehynRdOuFtlCSrTjKvDl8ZcB6+Poe+4AoROrCMqTpCFXQtQv3Mh6 SctgTISD7lE7iHq5ydOHlkW8wyQjCSvfr+hvYWQppRciHJLBi6sDh46Xb5Iw466Kh6js ggUZz3QMKAGz8IpmJgShuRWHN8XFbPnkddxO0NfQoyBLwrtSU0tDhxVXPx9drPvg1kjL o5QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mJH7gOdrMMGyFQ8LKTWhVkjGeJHdHILx+XSnBNhOxgI=; b=GkcFxiE33jngejOL8V+cihoW2hSPGxbjB+Gr3KwgBi1JZc98KRimpCCqOwKF2pyxsO yxJd2tYMUHBdXEUDPCYuWcQb46mqv75i9UqPbLRAFXQqZr52az6cYHObRUOKFdAPfF2a O7lHDY9VUnFJRy1UzCgSSC+NppgQO9K2xyoi+G0cYn1buP51Fe4bjv9jufE+6lz4qceD W0uUtsScTTcdW1u9uL57G/5/o1t6iPll5K/9BM9MNW9i8HfpfWnW9GKWqe/iGh08kUnw 5lXI1sKfin61qlQq1yw7oGPBFt16jFafCcGMMcCkFkAy1bOqlx7HA3vFh/+4Nn7Uc5rZ 3DmQ== X-Gm-Message-State: AOAM533nKFhcx8bAB3WYH7kjOH0MsAIHEr/e2Xf1j5fi74Lc24bNqFUg tAugZ5D6Z1NaVkeTJxyqmh92C4VA0VQZNh/PCJd+XA== X-Google-Smtp-Source: ABdhPJw9w0Kr8vlMJJtVxMulbiCYt/qShrmBebNCBPVEfOKE1nWh/4ZiPBMLiR1ZY2yId+VPA4xbmyBk+QkQqR2ilck= X-Received: by 2002:aca:de41:: with SMTP id v62mr1135294oig.132.1611092368607; Tue, 19 Jan 2021 13:39:28 -0800 (PST) MIME-Version: 1.0 References: <6c7b3cb6-5c0d-e9ae-67ea-a194cf9f9181@eastlink.ca> <7025ab43-7e15-df70-d09f-91ebaae2b7f2@eastlink.ca> <8868DABE-1D18-400F-A8F7-31450A892F0D@larryv.me> <161abccc-2323-8f22-70f9-f5edf59a61e7@eastlink.ca> In-Reply-To: <161abccc-2323-8f22-70f9-f5edf59a61e7@eastlink.ca> From: Bart Schaefer Date: Tue, 19 Jan 2021 13:39:17 -0800 Message-ID: Subject: Re: xargs with zsh function To: Ray Andrews Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 26400 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: On Tue, Jan 19, 2021 at 12:27 PM Ray Andrews 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.