In Bash scripts, Sometime we need to write while loop in we need to increment or decrement counter or variables for normal function of loops.we can do this with some simple code in bash

Let see some examples below in which counter increment used to demonstrate various know ways to increment values in bash for automation scripts.

#!/bin/bash
read -p "please mentioned number for Table :" number
count=1
while [ $count -le 10 ];do
echo -n "$number X $count ="
echo "$number*$count"| bc
(( count++ ))
done
#!/bin/bash
read -p "please mentioned number for Table :" number
count=1
while [ $count -le 10 ];do
echo -n "$number X $count ="
echo "$number*$count"| bc
let count=count+1
done
#!/bin/bash
read -p "please mentioned number for Table :" number
count=1
while [ $count -le 10 ];do
echo -n "$number X $count ="
echo "$number*$count"| bc
count=$((count+1))
done
#!/bin/bash
read -p "please mentioned number for Table :" number
count=1
while [ $count -le 10 ];do
echo -n "$number X $count ="
echo "$number*$count"| bc
let count++
done
#!/bin/bash
read -p "please mentioned number for Table :" number
count=1
while [ $count -le 10 ];do
echo -n "$number X $count ="
echo "$number*$count"| bc
count=$(($count+1))
done
#!/bin/bash
read -p "please mentioned number for Table :" number
count=1
while [ $count -le 10 ];do
echo -n "$number X $count ="
echo "$number*$count"| bc
count=$[ $count+1 ]
done