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


Shell-script - Example of for loop statement
The topic on Shell-script - For loop in shell scripting is posted by - Mylove
Hope you have enjoyed, Shell-script - For loop in shell scripting . Thanks for your time.

All rights reserved. © www.w3calculator.com