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 " ")
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
Thanks Paul and Chet;
They both do the same thing and that's exactly what I was looking for.
Thanks again,
Matthew.
Chet Ramey wrote:
>
> Paul Jarc wrote:
>
>> date1=`perl -e 'print time()'`
>> ...
>> date2=`perl -e 'print time()'`
>> interval=`expr "$date2" - "$date1"`
>
> This general ap
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