Loop judgment statement in Shell (1) for statement

Format of for statement

for  (exp)            #判断条件,只要满足就执行循环,不满足则跳出
do  
     statement        #循环内容
 
done                  #结束循环 

Examples:

Calculate odd numbers and sums within 1-100.
Insert picture description here
Insert picture description here
Practical script.
Exercise 1: Calculate the factorial through a for loop.
Insert picture description here
Insert picture description here
Exercise 2: Create a batch of new users in a for loop.
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_42958401/article/details/108487887