Shell-script - For loop in shell scripting, Example of for loop statement

For loop in shell scripting


For loop in bash script

Use the below code to print the particular string for 100 times using for loop

Create hello.sh file
echo $0
n=$1
for(( i = 1 ; i <=100 ; i++ ))
do
echo "$i $n "
done

Execute hello.sh file
sh hello.sh mylove

Output
1 mylove
2 mylove
3 mylove
........
........
100 mylove
The above program will print mylove for 100 times

The topic on Shell-script - For loop in shell scripting is posted by - Mylove

Hope you have enjoyed, Shell-script - For loop in shell scriptingThanks for your time

Tech Bluff