Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: time for loop
- X-seq: zsh-users 23795
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: <zsh-users@xxxxxxx>
- Subject: Re: time for loop
- Date: Mon, 3 Dec 2018 16:36:58 +0000
- Cms-type: 201P
- Dkim-filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20181203163700euoutp02aac951b0db6a57ff34ffdfd0ae63119c~s3-Y_ZNSr0856808568euoutp02T
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1543855021; bh=fMzowD5stP1R8pJlzTxGLagXMYdeUpK1XUaBom916Gs=; h=Subject:From:To:Date:In-Reply-To:References:From; b=sFvj9PIn/Nx6ggrrLo49rrbYaphQERVc5gZz/VqDnTax8JMP6gjbJcaJkwYcxWwXs E0Ox0htQtOakCY/5/Lpj1RG/vSZwfyXiQt20XdAdrxazI6BNCQeAKk4JvTbBzpGegQ Jz5uNZzRZoM29i9T2JC86HtvBbOyD9spIx7ziaw8=
- In-reply-to: <CABrM6w=4zXVsmgQDZXfUoQhEVPRFQxS2LnGREXSoREoDiRJaxQ@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CGME20181203160732epcas4p3be986c9149fc8a51e296c882b5f979e4@epcas4p3.samsung.com> <CABrM6w=4zXVsmgQDZXfUoQhEVPRFQxS2LnGREXSoREoDiRJaxQ@mail.gmail.com>
On Mon, 2018-12-03 at 10:05 -0600, Peng Yu wrote:
> time for ((i=0;i<1000;++i))
> do
> :
> done
>
> The zsh manual says it only support pipeline.
Actually, that's another piece of documentation that's not really
accurate. The code is parsed fine, but the implementation of "time"
internally only works if the code being timed was run in a separate
process.
Compare the syntactically very similar
time ( print foo )
and
time { print foo }
You get a time only with the first one.
As zsh has been around for over 25 years now, you'll realise that
limitations like this aren't going to change (unless you decide to look
at it yourself, please feel free!), and nor is the basic syntax outside
compatibility mode.
pws
Messages sorted by:
Reverse Date,
Date,
Thread,
Author