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

Re: Redirect output of time builtin



On Jul 13,  1:46am, Matthias Vallentin wrote:
} Subject: Re: Redirect output of time builtin
}
} > In order to split the stderr of time from the stderr of the pipeline,
} > you need to get a little trickier:
} > 
} >     { time simple command 2>&3 } 3>&2 2>time.txt
} 
} I was exactly looking for this sort of splitting. What I am wondering is
} whether there is a way to avoid hitting the disk and instead redirect
} the output of time into some piece in memory.

time_out=$( { time simple command 2>&3 >&/dev/tty } 2>&1 3>&2 )

This isn't useful in a pipeline, though, and you may need to replace
>&/dev/tty with explicit shuffling of descriptors 1 and 2, and I don't
promise that interactive commands won't be seriously messed up.



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