bug-bash
[Top][All Lists]
Advanced

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

Re: Timing an operation


From: Andreas Schwab
Subject: Re: Timing an operation
Date: Fri, 25 May 2007 16:52:59 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.97 (gnu/linux)

Matthew_S <M_Sleaford@hotmail.com> writes:

> Sorry guys, I need to take it a step further and am hitting a wall at the
> moment;
>
> I need to take two results (from you examples), compare them and get a final
> result.  What I have thus far is;
>
> operation()
> {
> echo >> $LOG
>         echo Running operation>> $LOG
>         for i in a b 
>         do
>                 mkdir $DIR/dir$i
>                 cd $DIR/dir$i
>                 date1=$SECONDS
>                 operation
>                 date2=$SECONDS
>                 interval$i=$(($date2 - $date1)) #1st & 2nd errors

If you want to set a computed variable you need to use eval.

                  eval interval$i='$(($date2 - $date1))'

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

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