zl程序教程

您现在的位置是:首页 >  其他

当前栏目

Shell while 语法

shell 语法 while
2023-09-14 09:11:34 时间

1、100内整数求和 

i=1
while [ $i -le 100 ]
do
    let sum+=$i
    let i++
done
echo $sum

2、逐行读入一个文件

while read row
do
   user=`echo $row | awk '{print $1}'`
   echo $user
done < user01.txt