🚀 Learn 90+ coding courses & crack 200+ competitive exams — powered by learning intelligence on Leyaa.ai →
Shell script to print numbers from 1 to 100
Let's write a shell script to print numbers 1 to 100.
This will help us to understand the basics of looping statements in shell script.
Print numbers 1 to 100 using while loop - Shell Script
#shell script to print numbers 1 to 100 i=1 while [ $i -le 100 ] do echo $i i=$(($i+1)) done
-le stands for less than or equal to.
Same program using expr
#shell script to print numbers 1 to 100 #using while loop and expr i=1 while [ $i -le 100 ] do echo $i i=`expr $i + 1` done
Print numbers 1 to 100 using for loop - Shell Script
#shell script to print numbers 1 to 100 #using for loop for((i=1;i<=100;i++)) do echo $i done
🚀 Your coding + exam prep journey starts here
Learn Python, C, Java, SQL & 90+ technologies. Practice for IBPS, SSC, Railway & 200+ exams. All powered by AI. All free.
Get Started on Leyaa.ai →