On 1/27/16 5:59 AM, Stephane Chazelas wrote:
> Hello,
>
> (tested with bash-4.3 and bash-2.05b)
>
> "time" is meant to time a pipeline. That generally includes
> redirections of the last command in the pipeline, but in the
> case of a subshell alone, the redirection is not timed(*) and
> seems to affect the output of "time" itself.
It's the way the bash implementation was from the start. If the command
to be timed is run in a subshell and not part of a pipeline, the shell
forks early and runs the command in a subshell. In this case, that
subshell performs redirections before doing much of anything else.
As you note below, some people have relied on it.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/