#!/bin/bash
printf 'm='
read m
printf 'n='
read n
a=$m
sum=0
while [ $a -le $n ]
do
let sum=sum+a
let a=a+1
done
echo "result: $sum"
root@server:~# bash sum.sh
m=2
n=6
result: 20
root@server:~#
#!/bin/bash
printf 'm='
read m
printf 'n='
read n
a=$m
sum=0
while [ $a -le $n ]
do
let sum=sum+a
let a=a+1
done
echo "result: $sum"
root@server:~# bash sum.sh
m=2
n=6
result: 20
root@server:~#