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

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. Non-blocking named papes
came to mind, but I haven't figured out whether this is the right
approach:

    mkfifo /tmp/fifo
    { time command 2>&3 } 3>&2 2<>/tmp/fifo

The above fails if there is no process reading from /tmp/fifo when the
time output is written. In fact, a FIFO would be overkill since I only
need constant space to store the output rather than a message pipe.

Ideally the output would be written into an environment variable. Is
this doable?

    Matthias



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