bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why does time (cmd) 2> file redirect time's output?


From: Stephane Chazelas
Subject: Re: why does time (cmd) 2> file redirect time's output?
Date: Wed, 9 Mar 2016 14:50:49 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

2016-03-09 08:04:33 -0500, Chet Ramey:
> On 3/8/16 6:04 AM, Isabella Parakiss wrote:
> 
> > 
> > This seems to be a related problem:
> > $ time (exec true)              # doesn't print anything
> 
> Timing is an attribute associated with a command.  In this case, that's the
> simple command (`exec true') that is run in a subshell.  When that command
> is executed, the shell that is started to run the subshell and print the
> timing statistics is overwritten by the `exec true'.
[...]

Or in other words, 

time (cmd) [redirections]

is actually interpreted as if you had entered:

(time { cmd; }) [redirections]

As you've confirmed it was the intended behaviour (and anyway
some people rely on it), it would be worth documenting IMO.

-- 
Stephane



reply via email to

[Prev in Thread] Current Thread [Next in Thread]