How to create a counter in Bash?

Bash Liste Des Attaques Ovh

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  





Discover More
Bash Liste Des Attaques Ovh
Bash - Integer

This article is the management of integer in bash. See See The ordinal comparison operator in Bash are: Double Bracket operator Single Bracket Operator Example -lt -lt [[ 8 -lt 9 ]] && echo "8 is less than 9"...



Share this page:
Follow us:
Task Runner