Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: time(1) has no effect when used on a built-in



On 2025-09-04 16:47:59 -0400, Lawrence Velázquez wrote:
> On Thu, Sep 4, 2025, at 3:53 PM, avidseeker wrote:
> > Not sure if this is intentional, but looks like a bug.
> 
> See also:
> 
> https://www.zsh.org/mla/users/2023/msg00127.html
> https://www.zsh.org/mla/workers/2024/msg00597.html
> 
> Timing built-ins was implemented on the master branch during the
> latter thread.

This is a limitation that has been known for a very long time.
For instance, in zsh-users 15743

  https://www.zsh.org/mla/users/2011/msg00066.html

Bart Schaefer said:

│Additional note:  The time builtin applied to any construct that is
│executed in the current shell, is silently ignored.  So although
│it's syntactically OK to put an opening curly or a repeat-loop or
│the like immediately after the time keyword, you'll get no timing
│statistics.  You have to use parens instead, to force a subshell,
│which is then timed.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)




Messages sorted by: Reverse Date, Date, Thread, Author