for循环实现1-100加和,剔除位4尾号

#!/bin/bash
i_End=4
i_Total=0
for((i=1;i<=100;i++))
do
	i_temp=`expr $i % 10`
	if [ $i_temp -eq $i_End ];
	then
		echo "跳过:${i}"
		continue;
	fi
	
   i_Total=$((${
    
    i_Total}+i))
done

echo "Total=${i_Total}"

猜你喜欢

转载自blog.csdn.net/qq_41920585/article/details/109815343