#!/bin/bashsum=0for i in {1..100}do if [ $(( $i % 3 )) -eq 0 ] then echo $i sum=$(( $sum + $i )) fidoneecho "sum is: $sum"
保存为sum.sh