累加脚本:


# vi sumer.sh

#!/bin/bash
result=0  
while [ $# -gt 0 ]
do
result=`expr $result + $1`
shift
done
echo "The sum is: $result"

 

# sh sumer.sh 15 64 ...