[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: time doesn't behave
From: |
Vasco Pedro |
Subject: |
Re: time doesn't behave |
Date: |
Fri, 06 Apr 2001 14:40:25 +0100 |
Hi,
> I am trying to 'time' a process and grep the output.
> For some reason the 'time' is not behaving correctly:
>
> ===>
> eelco@ns6:~> time namp localhost 2>&1 | grep real
>
> real 0m0.455s
> user 0m0.100s
> sys 0m0.190s
> ===<
> While this should be:
>
> ===>
> eelco@ns6:~> time namp localhost 2>&1 | grep real
>
> real 0m0.455s
> ===<
>
> The problem seems to be that the output of time bypasses the grep, venthough
> I've redirected stderr to stdout.
>
> Any idea what's wrong?
`time' isn't just timing the namp command, it times the whole pipe.
To get what you want, you should write
(time namp localhost) 2>&1 | grep real
Better yet, use the TIMEFORMAT variable.
Regards,
vasco