Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: xargs with zsh function
- X-seq: zsh-users 26392
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: xargs with zsh function
- Date: Mon, 18 Jan 2021 14:14:18 -0800
- Archived-at: <https://zsh.org/users/26392>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-users/2021-01/a1319762-f8d9-38c6-9471-b7d066bec1a1%40eastlink.ca>
- In-reply-to: <CAH+w=7YREDgH5WZvK4wpBt8GD21ic6vJBY_ZU6HCpAWjU79KYg@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <eee04aa4-394f-9e4b-1637-538059745b5c@eastlink.ca> <CAH+w=7YREDgH5WZvK4wpBt8GD21ic6vJBY_ZU6HCpAWjU79KYg@mail.gmail.com>
On 2021-01-17 7:10 p.m., Bart Schaefer wrote:
How about this:
$ autoload zargs
$ xzargs() { zargs -- "${(f)$(read -d '' -E)}" -- "$@" }
$ ... | xzargs my_function
Playing with that running this script (test):
autoload zargs
xzargs() { zargs -t -- "${(f)$(read -d '' -E)}" -- "$@" }
function el ()
{
echo howdy
}
vvar=( 'mnt' 'rap' )
print -l "$vvar" | xzargs el
------------------------------------------
$ . test
xzargs: bad math expression: operator expected at `rap'
el mnt rap
howdy
... It works fine with a single literal input or a single string
variable but I'd want to be throwing large numbers of lines at this. I
know the receiving function might have to be feed them one at a time,
which is easy, but I can't get zargs to swallow more than one string.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author