Re: Linux measuring elapsed time for a shell command

From: Nick Landsberg (hukolau_at_NOSPAM.att.net)
Date: 05/11/04


Date: Tue, 11 May 2004 16:20:56 GMT

Peter Grossi 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

On some shells, "time" is a built-in and may
not be subject to redirection. See if there's
a /usr/bin/time on your system. If there is
you CAN redirect it's output (which is stderr)

HTH

-- 
"It is impossible to make anything foolproof
because fools are so ingenious"
  - A. Bloch


Relevant Pages

  • Re: ksh silently ignores function if mistakenly not autoloaded
    ... Here's the order of execution. ... This really takes place prior to command ... Shell scripts, with all their power, have one major drawback - they ... In the Korn Shell, there are two separate syntaxes for defining ...
    (comp.unix.shell)
  • Re: Spawning process with environment variables
    ... starting the shell). ... command on the fly. ... a single-line script to a shell for execution. ... execution of shell scripts instead of writing shell script controlling ...
    (comp.unix.programmer)
  • RE: Perl code security (CGI related)
    ... Perl code security ... function allow execution of command such as "rm -rf *". ... However it does not have any effect if $code is shell command such as ...
    (SecProg)
  • Re: Linux measuring elapsed time for a shell command
    ... Peter Grossi wrote: ... > I am trying to measure the elapsed time for execution of a shell ... > executed and the time statistics are reported on screen. ... > the command output to a file or pipe the time statistics will only go ...
    (comp.os.linux.misc)
  • Re: 16bit edit
    ... [[When a command is entered for execution by this shell, ... >>> on some other computers, it works perfectly under xp! ...
    (microsoft.public.windowsxp.configuration_manage)