>I want to time a command and redirect the outputs of both commands to a file.
> time my_command > out
> 0.2u 0.3s 0:00 58% 0+280k 13+0io 11pf+0w
>How do I do that? Thanks in advance.
From experimentation and a bit of what I hope is educated guessing, I'd
say there are two ways for you to do this.
If the 'time' you are using is a shell built-in, then since the shell is
printing it out and not a running process, you can't just redirect it. So,
what you do is put it in a sub-shell and redirect THAT output. e.g.
(time ls) >file_listing 2>time_info
The subshell will print out the time output, but to the parent shell
this is the subshell's stderr.
Or, you could use an executable instead of the shell built-in:
/bin/time ls >file_listing 2>time_info
----------- The opinions expressed in this article are solely mine. -----------
<Insert lame attempt at disclaimer humor>
If you're not part of the solution, you're part of the precipitate. [fortune]