[root@eshop-detail03 shell]# vi while.sh
#!/bin/bash
s=0
i=1
while [ $i -le 100 ]
do
s=$[$s+$i]
i=$[$i+1]
done
echo $s
"while.sh" [New] 10L, 95C written
[root@eshop-detail03 shell]# chmod 777 while.sh
[root@eshop-detail03 shell]# ./while.sh
5050