一个简单的使用while循环计算1到100之和:cat 1-100.sh #!/bin/shk=1sum=0while [ $k -le100 ]do let sum=sum+k let k=k+1doneecho $sum	转载于:https://blog.51cto.com/hejianping/1749324...
一个简单的使用while循环计算1到100之和:
cat 1-100.sh
#!/bin/sh
k=1
sum=0
while [ $k -le 100 ]
do
let sum=sum+k
let k=k+1
done
echo $sum
转载于:https://blog.51cto.com/hejianping/1749324
do…while循环while循环 for循环

do…while循环

while循环

for循环