351 B
351 B
- exit 退出程序
- continue 进行下一次循环
- break 退出循环
- shift 输入参数位移
#! /bin/env bash
sum=0
for i
do
let sum+=$i
done
echo $sum
#! /bin/env bash
sum=0
while [ $# -ne 0 ]
do
let sum+=$1
shift
done
echo $sum
#! /bin/env bash
sum=0
while [ $# -ne 0 ]
do
let sum+=$1
shift 2
done
echo $sum