Chad Mynhier wrote:
On 4/19/07, Glenn Lagasse <[EMAIL PROTECTED]> wrote:
Atul Vidwansa wrote:
> HI,
> If I want to time a utility, Linux allows me to do something like:
>
> time -oa <filename> utility <arguments>
>
> which is convinient to put in shell script. On opensolaris, man page
> of time(1) does not show any such option. Isn't it possible to record
> output of time command (not of the utility invoked) in a file on
> opensolaris?
Not from the time(1) utility itself according to:
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/time/time.c
But it doesn't seem like it would be all that hard to add this
functionality in printt(). Might make a good RFE (if there isn't one
already).
Cheers,
--
Glenn Lagasse
But note that the time(1) utility writes to stderr, not stdout, so you
can just use redirection to get the output in a file:
/bin/time echo foo 2>/tmp/foo
foo
Yep, I neglected to specify /bin/time when I was testing this and was
thus getting the time function from my shell where this (redirection)
doesn't work.
If you explicitly call /bin/time with redirection of stderr as outlined
above it does work. One thing to note is that if the command your
timing spits anything out to stderr it will wind up in your log file as
well which might not be what you want.
Cheers,
--
Glenn Lagasse
Solaris Install
Sun Microsystems, Inc.
_______________________________________________
opensolaris-discuss mailing list
[email protected]