shell脚本for和while的使用

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#!/bin/bash
sum=0;

for ((i=1; i<=10; i++));
do
    let "sum=$sum+$i";
done

echo $sum;

for j in $(seq 1 10)
do
   let "sum=$j+$sum";
done

echo $sum;

i=1;
while(($i<=10))
do
    let "sum=$sum+$i";
    let "i=$i+1";
done

echo $sum;
min=1;
max=10;
# 注意"[ ]"的空格
while [[ $min -le $maxi ]]
do
    let "sum=$sum+$i";
    let "i=$i+1";
done

echo $sum;