Shell script to find the sum of argument passed to the script

view full story

http://www.unix.com – 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 : Code: #!/bin/bash sum=0 for i in $@ do     sum=$sum+$1     echo $sum     shift done I am executing the script as below Code: sh script 4 5 6 7 the output that I am getting is Code: 0+4 0+4+5 0+4+5+6 0+4+5+6+7 (HowTos)