#!/bin/sh
# calculate the sum from 1 to n
# validate the varibles number
if [ $# -ne 2 ] ; then
echo "usage : sum.sh start end"
exit
fi
start=$1
end=$2
while [ $start -lt $end ]
do
sum=$sum+$start
echo "$sum"
start=$start+1
done
echo "the result is $sum"
# calculate the sum from 1 to n
# validate the varibles number
if [ $# -ne 2 ] ; then
echo "usage : sum.sh start end"
exit
fi
start=$1
end=$2
while [ $start -lt $end ]
do
sum=$sum+$start
echo "$sum"
start=$start+1
done
echo "the result is $sum"