Table of Contents

About

This article shows you how to create a integer counter in Bash

Example

basic

count=0  
count=$(( count + 1 ))

In a loop

With the integer comparison operator and an arithmetic operation

count=0 
while [ $count -le 10 ]  
do  
    echo "$count"
    count=$(( count + 1 ))
done