When preparing scripts that will run in bash, it’s often critical to be able to set up numeric variables that you can then increment or decrement as the script proceeds. The only surprising part of this is how many options you have to choose from to make the increment or decrement operation happen.
Incrementing numeric variables
First, to increment a variable, you first need to set it up. While the example below sets the variable $count to 1, there is no need to start at 1.
$ count=1
This would also work:
$ count=111
Regardless of the initial setting, you can then increment your variable using any of the following commands. Just replace $count with your variable name.
To read this article in full, please click here
Source:: Network World – Linux