shell脚本for和while的使用

2019PHP高薪工程师学习路线图....>>>

#!/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;