Matthew_S <[EMAIL PROTECTED]> 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
Matthew_S wrote:
> interval$i=$(($date2 - $date1)) #1st & 2nd errors
> ...
> I'm getting the errors;
> ./file.sh: line x: intervala=1: command not found
> ./file.sh: line x: intervalb=1: command not found
> ./file.sh: line x: - : syntax error: operand expected (error token is " ")
27;' - Chaucer
>> Live Strong. No day but today.
>> Chet Ramey, ITS, CWRU[EMAIL PROTECTED]
>> http://cnswww.cns.cwru.edu/~chet/
>>
>>
>> ___
>> Bug-bash mailing list
>> Bug-bash@gnu.org
&g
ft so long to lerne.'' - Chaucer
> Live Strong. No day but today.
> Chet Ramey, ITS, CWRU[EMAIL PROTECTED]
> http://cnswww.cns.cwru.edu/~chet/
>
>
> ___
> Bug-bash mailing list
> Bug-bash@gnu.org
&g
Paul Jarc wrote:
> date1=`perl -e 'print time()'`
> ...
> date2=`perl -e 'print time()'`
> interval=`expr "$date2" - "$date1"`
This general approach can be used without invoking any external programs:
date1=$SECONDS
...
date2=$SECONDS
interval=$(( $date2 - $date1 ))
Chet
--
``The lyf so short,
Matthew_S <[EMAIL PROTECTED]> wrote:
> Can i have something like;
>
> if
> difference between dates <5seconds
> echo fail
> fi
date1=`perl -e 'print time()'`
...
date2=`perl -e 'print time()'`
interval=`expr "$date2" - "$date1"`
if test 5 -gt "$interval"; then
echo fail
fi
On some systems, yo
essage in context:
http://www.nabble.com/Timing-an-operation-tf3809131.html#a10780790
Sent from the Gnu - Bash mailing list archive at Nabble.com.
___
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash