[Top][All Lists]

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

Re: Timing an operation

From: Bob Proulx
Subject: Re: Timing an operation
Date: Fri, 25 May 2007 08:47:50 -0600
User-agent: Mutt/1.5.9i

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 " ")

Variables cannot appear as you have put them on the left hand side of
the assignment expression.  You need to expand the variable first.  In
this case use an eval.

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

The eval will cause the $i and the rest to be expanded and then the
resulting text will be evaluatated again causing the assignment to


reply via email to

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