#!/bin/bash a=0 sum=0 until [ $a -gt 100 ] do sum=`expr $sum + $a` a=`expr $a + 1` done echo $sum 输出结果: 5050