#! /bin/bash echo 计算出1-100的奇数之和 sum=0 for i in $( seq 1 2 100) do let "sum+=i" done echo result=$sum
[[email protected] Desktop]# ./countjishu.sh 计算出1-100的奇数之和 result=2500
时间: 2025-01-10 18:48:04
#! /bin/bash echo 计算出1-100的奇数之和 sum=0 for i in $( seq 1 2 100) do let "sum+=i" done echo result=$sum
[[email protected] Desktop]# ./countjishu.sh 计算出1-100的奇数之和 result=2500