From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3492 invoked by alias); 20 Aug 2015 15:56:02 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 20446 Received: (qmail 8014 invoked from network); 20 Aug 2015 15:55:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-AuditID: cbfec7f4-f79c56d0000012ee-9e-55d5f88b81df Date: Thu, 20 Aug 2015 16:55:52 +0100 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: list last modified files Message-id: <20150820165552.2b5ec817@pwslap01u.europe.root.pri> In-reply-to: <150820083431.ZM29050@torch.brasslantern.com> References: <6ac3d5e6.2de49d01.55d4fc3c.9415a@prokonto.pl> <150819213302.ZM28036@torch.brasslantern.com> <794c2899.3f499b8c.55d5d132.18267@prokonto.pl> <20150820142913.77fa5bca@pwslap01u.europe.root.pri> <150820083431.ZM29050@torch.brasslantern.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrCLMWRmVeSWpSXmKPExsVy+t/xq7rdP66GGhzaqWyx4+RKRgdGj1UH PzAFMEZx2aSk5mSWpRbp2yVwZew5u5qp4C93xY2tL9kaGKdzdjFyckgImEhcmdLMCmGLSVy4 t56ti5GLQ0hgKaPEzVnHGSGcaUwSe059YIVwtjFKHLnWzwbSwiKgKjHnygQwm03AUGLqptmM ILaIgKjE8hWb2UFsYaCamT1/WboYOTh4BewlXuwuBQlzClhJPJzTwwIxs5FJYse0BrBefgF9 iat/PzFBnGQvMfPKGbA4r4CgxI/J91hAbGYBLYnN25pYIWx5ic1r3jKD2EIC6hI37u5mn8Ao NAtJyywkLbOQtCxgZF7FKJpamlxQnJSea6hXnJhbXJqXrpecn7uJERK2X3YwLj5mdYhRgINR iYf3gvDVUCHWxLLiytxDjBIczEoivLeeAYV4UxIrq1KL8uOLSnNSiw8xSnOwKInzzt31PkRI ID2xJDU7NbUgtQgmy8TBKdXAaNdns85HRUx6/z+ebe/LHLp+2zgFbHASOGVpIDF5b8Gf5OW3 mKRM+DV+5gfkfN788PFirf+fnV5c+Dz11g2Jsui3AWa7zn579Kjlf3qDlU5Iw8Qi1foF72ZP FZts+nDL3kcHtqhxOOm0rDH+spf1mI6O3NLpB+VPCaU75a6axZZcfu/yfscJR5VYijMSDbWY i4oTAaq2V0pXAgAA On Thu, 20 Aug 2015 08:34:31 -0700 Bart Schaefer wrote: > On Aug 20, 2:29pm, Peter Stephenson wrote: > } > } On Thu, 20 Aug 2015 15:08:02 +0200 > } rooom wrote: > } > BTW, what is 'in'? > } > } It's simply a syntactic marker specific to "for" which looks for it in > } the list of arguments. In the original shell syntax it's not > } really doing much except make it a bit more readable since you're forced > } to use "for var in ...", but zsh makes a virtue of it by allowing you > } to do "for var1 var2... in ..." --- unless your variable is called "in", > } obviously, in which case you can't. > > Well ... If you mean you'd rather blind me with code than state the rule... that worked. The rule is roughly: - Assume the first argument is a variable. This is needed for backwards compatibility. Note you can't do: vars=(one two three) for $vars in 1arg1 2arg1 3arg1 1arg2 2arg2 3arg2; ... - Otherwise, look for more variables until a word matches "in" (ignoring crazy variant zsh syntax) - If no "in", use positional parameters. - Otherwsie, any words after "in" are the arguments to loop over, taken in batches of the number of arguments before "in". The words are no longer subject to anything more than normal argument processing. The rule means this does work: set -- 1 2 3 4 5 6 for one two three; do print $one $two $three done 1 2 3 4 5 6 and you can replace "one" by "in" if you lke, but don't. pws