Time command

Michael Brömer mib at telebel.de
Wed Jun 5 12:15:12 PDT 2002


Am Mittwoch, 5. Juni 2002 20:51 schrieben Sie:
> I'm using time { ./configure && make && make install &&; } to collect
> SBU's. But I want to do it in a script. I tried:
>
> echo "#package-name" >> ~/SBU &&
> time { ./configure && make && make install &&; } 2>&1 |tee >>~/SBU
>
> but only the compile output is shown. I've also tried a direct >> and
> 2>&1 >> both, without tee. Any ideas?

The bash build-in time command made me go berserk! Therefore i
decided to do it properly and get me GNU time. There you can 
measure and time about anything and have nice formats for the output
to choose from.

It installs with the usual
:> ./configure --prefix=/usr
:> make
:> make install
:> ln -sf /usr/bin/time /usr/bin/gtime

I like to use it in my scripts like
:> gtime -o $TIMEFILE -f %E $MY_MIGHTY_COMMAND_OR_SCRIPT
:> duration=`cat $TIMEFILE | cut -d . -f1`

%E gives you the elapsed real time (in [hours:]minutes:seconds)

I guess i am just to stupid (or to lazy) to figure out
the bash built-in time command.

Michael

-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-dev' in the subject header of the message



More information about the lfs-dev mailing list