bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: time doesn't behave


From: EHV-00
Subject: Re: time doesn't behave
Date: Tue, 10 Apr 2001 11:30:56 +0200

Dear Francis,

Adding the subshell-brackets does it for me....
Thanks a lot for your great help.

Kind Regards,

Eelco
"Francis Montagnac" <address@hidden> wrote in message
news:address@hidden
> In article <address@hidden>,
>  "EHV-00" <address@hidden> writes:
> >Dear all,
>
> >I am trying to 'time' a process and grep the output.
> >For some reason the 'time' is not behaving correctly:
>
> >===>
> >address@hidden:~> time namp localhost 2>&1 | grep real
> >
> >real 0m0.455s
> >user 0m0.100s
> >sys 0m0.190s
>
> You should use a subshell to do that. Try:
>
> (time namp localhost) 2>&1 | grep real
>
> I use the following function to capture the realtime spent by a process:
>
> realtime() {
>     {
>         ( TIMEFORMAT="%R"; time { { "$@"; } >&4 2>&1 ; } ) 2>&1
>     } 4>&2
> }
>
> then just say:
>
> var=$(realtime namp localhost)
>
> to store the real time spent in var.
>
> --
> address@hidden, Tel: (33)04 92 38 79 11
> INRIA Sophia, 2004, rte des Lucioles, B.P.93 - 06902 Sophia Antipolis
Cedex





reply via email to

[Prev in Thread] Current Thread [Next in Thread]