Re: Linux measuring elapsed time for a shell command
From: Alan Connor (zzzzzz_at_xxx.yyy)
Date: 05/11/04
- Next message: thomas\: "poweroff/reboot as normal user?"
- Previous message: John Thompson: "Re: tar whole windows partition"
- In reply to: Peter Grossi: "Linux measuring elapsed time for a shell command"
- Next in thread: Hamish McWilliam: "Re: Linux measuring elapsed time for a shell command"
- Reply: Hamish McWilliam: "Re: Linux measuring elapsed time for a shell command"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 11 May 2004 19:09:07 GMT
On 11 May 2004 08:27:08 -0700, Peter Grossi <google@grossi.co.uk> wrote:
>
>
> Hi
>
> I am trying to measure the elapsed time for execution of a shell
> command under RedHat 9.0
>
> By putting "time" at the start of the command line, the command is
> executed and the time statistics are reported on screen.
>
> E.g. time dir
>
> The problem is that I need the time statistics to be redirected to a
> file or to a pipe. I have tried various things, but while I can get
> the command output to a file or pipe the time statistics will only go
> to the terminal screen.
>
> Can anybody help?
>
> Thanks
>
> Peter Grossi
Got a workaround, since the bash builtin doesn't seem to have the option
to re-direct the output to a file:
$ script outputfile
$ time command &> /dev/null
$ time command &> /dev/null
Ctrl-d
(to end the script session)
Now the output of everything that went to your terminal is in outputfile,
with what you want and some stuff that you don't :-) The -a option to script
will append-to rather than overwrite outputfile for successive script sessions.
The normal output of the commands are sent to /dev/null to keep
the outputfile as clean as possible.
outputfile can have any name at all, default is "typescript" if
you don't specify a file.
AC
-- Pass-List -----> Block-List ----> Challenge-Response The key to taking control of your mailbox. Design Parameters: http://tinyurl.com/2t5kp || http://tinyurl.com/3c3ag Challenge-Response links -- http://tinyurl.com/yrfjb
- Next message: thomas\: "poweroff/reboot as normal user?"
- Previous message: John Thompson: "Re: tar whole windows partition"
- In reply to: Peter Grossi: "Linux measuring elapsed time for a shell command"
- Next in thread: Hamish McWilliam: "Re: Linux measuring elapsed time for a shell command"
- Reply: Hamish McWilliam: "Re: Linux measuring elapsed time for a shell command"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|