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
occur.

Bob


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to