ty9919 发表于 2018-8-23 07:16:02

shell脚本-while循环从1加到100

#!/bin/bash  
i=1
  
s=0
  
while [ $i -le 100 ]
  
do
  
s=$(( $s+$i ))
  
i=$(( $i+1 ))
  
done
  
echo "The sum is: $s"


页: [1]
查看完整版本: shell脚本-while循环从1加到100