Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Problems with zargs (Was: xargs should be a builtin)
- X-seq: zsh-workers 30389
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- Subject: Re: Problems with zargs (Was: xargs should be a builtin)
- Date: Thu, 12 Apr 2012 10:28:22 +0100
- Cc: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=2WVvoURaLk0KkEte7S2AB1oB/m4inuGPDMksYDKiPEk=; b=JnG2m5Wt6XVK+DPapw65MRBnCMPk1DuyM35TkQgkhxN45ZsLgJrqnZX1+DBYUbcaAk qfkp0xegBwnALHzzYXCQG5iA3Y41vjjQREfAb4tb+h1diJJzPE5ddtsTvoWVRnTDUohz i9ALPixSFUiXwdR6kxPRvCJHE9ToKwusp5AhBwgyD/FAehdlrW4Lmybkx5jLarlOLOYs YeIYY0KftUuv+fQIfT1WWg0SLv5oRUtNErrB/FA5ZWXIp4CscD8rqv3LnpykNJ8qwXck 2GgWqgev+913Y7ZeH6UbD6WCTe+ejl3983XNgGE/6ucabVl30iHvE+qwL2ORwrmgZvOb 9ttw==
- In-reply-to: <20120411171539.4a09da6a@pws-pc.ntlworld.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mail-followup-to: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>, "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <0363642A-FD71-4DEE-8284-D7E72EAC8AD0@Yost.com> <87k41mr9u7.fsf@ft.bewatermyfriend.org> <20120411100642.GA8180@chaz.gmail.com> <20120411171539.4a09da6a@pws-pc.ntlworld.com>
2012-04-11 17:15:39 +0100, Peter Stephenson:
> On Wed, 11 Apr 2012 11:06:42 +0100
> Stephane Chazelas <stephane.chazelas@xxxxxxxxx> wrote:
> > By the way, there seems to be some issues with zargs:
> >
> > ~$ zargs a b '' -- print -rl
> > a
> > b
> > ~$ zargs a -- print -rl ''
> > a
> > ~$ zargs -e a '' print -rl
> > a print -rl
> > ~$ zargs --eof= a '' print -rl
> > a
>
> It helps if everyone always says explicitly what the problem actually
> is, it saves lots of guesswork.
Sorry about that. Wrote in a rush.
> I've come up with the following for the problems I understand, but I'm
> sure it could do with a bit more prodding.
[...]
Thanks. That seems to do the trick.
May I knitpick:
~$ ''() echo X "$@"
~$ zargs 1 2 -- ''
1 2
~$ zargs 1 2 -- '' ''
X 1 2
--- zargs.old 2012-04-12 10:26:20.658633028 +0100
+++ /usr/share/zsh/functions/Misc/zargs 2012-04-12 10:27:20.709077765 +0100
@@ -174,7 +174,7 @@
else set -- "${(@)argv[1,end-1]}"
fi
-if [[ -n $command ]]
+if (($#command))
then (( c = $#command - 1 ))
else command=( print -r -- )
fi
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author