Addition in bash

Nils Kassube kassube at gmx.net
Wed Oct 14 08:12:54 UTC 2009


Ray Parrish wrote:
> I have the following script fragment
>
> Seconds=0;

Make that

declare -i Seconds=0

> while [ "$Seconds" -lt "60" ]
>   do
>   sleep 5;
>   Seconds=$Seconds+5;

Or as an alternative, here you could use

Seconds=$(($Seconds + 5))

And to the links posted by Rakotomandimby Mihamina, I would add this:

<http://www.gnu.org/software/bash/manual/index.html>


Nils





More information about the ubuntu-users mailing list