Linux Shell for循环

循环输出

#!/bin/bash
for i in `seq 1 20`
do
        echo -e "\033[32mThe Number is $i\033[0m"
done

求和

#!/bin/bash
H=0
for ((i=1;i<=100;i++))
do

        H=`expr $i + $H`

done
echo $H

你可能感兴趣的:(shell,linux,服务器,运维)