sum=6$ sh ./test.sh 1 2 3 4 5 6 7 8 9 10 sum=55 $ cat test.sh #!/bin/sh sum=0 until [ $# -eq 0 ] do sum=$(($sum+$1)) shift done printf "sum=%d" $sum