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.
This would also work:
Regardless of the initial setting, you can then increment your variable using any of the following commands. Just replace $count with your variable name.
Source:: Network World – Linux