Addition in bash

Ray Parrish crp at cmc.net
Wed Oct 14 07:24:20 UTC 2009


Hello,

I have the following script fragment

Seconds=0;
while [ "$Seconds" -lt "60" ]
  do
  sleep 5;
  Seconds=$Seconds+5;
  padsp espeak "$Seconds"
done

For some reason Seconds becomes "0+5" instead of the integer value 5 
which is what I am attempting to get it to be.

Does anyone know how to do integer math in bash?

Thanks for any help you can be.

Later, Ray Parrish

-- 
The Future of Technology.
http://www.rayslinks.com/The%20Future%20of%20Technology.html
Ray's Links, a variety of links to usefull things, and articles by Ray.
http://www.rayslinks.com
Writings of "The" Schizophrenic, what it's like to be a schizo, and other
things, including my poetry.
http://www.writingsoftheschizophrenic.com






More information about the ubuntu-users mailing list