使用for循环:
#!/bin/sh
#a:the start num b:the end num
#Calculates the sum of all integers between two Numbers
#a<b
read -p 'please input the starting num:' a
read -p 'please input the end num:' b
for i in `seq $a $b`
do
sum=$[$sum+$i];
done
echo $sum