shell腳本實例-for循環從1加到100

#!/bin/bash
s=0
for ((i=1;i<=100;i=i+1))
do
s=$(($s+$i))
done
echo "The sum of 1+2+...+100 is : $s"
相關文章
相關標籤/搜索