I want to make a script which takes the number of argument, add those argument and gives output to the user, but I am not getting through...
Script that i am using is below :
#!/bin/bash
sum=0
for i in $@
do
sum=$sum+$1
echo $sum
shift
done
I am executing the script as below
sh script 4 5 6 7
the output that I am getting is
0+4
0+4+5
0+4+5+6
0+4+5+6+7