#!/bin/bash

计算 1 到 100 的和

sum=0 for ((i=1; i<=100; i++)) do sum=$(($sum+$i)) done

echo '1 加到 100 的和为:$sum'

Shell 脚本计算 1 到 100 的和