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