- shell脚本计算1-50偶数和:
#!/bin/bash
item=2
sum=0
while [ $item -le 50 ]
do
let sum=$sum+$item
let item=$item+2
done
echo $sum
#!/bin/bash
item=2
sum=0
while [ $item -le 50 ]
do
let sum=$sum+$item
let item=$item+2
done
echo $sum