continue

#!/bin/bash

m=1
for (( i = 1; i <= 100; i++ ))
do
        let "temp1=$i%7"
        if [ "$temp1" -ne 0 ];then
                continue                        #如果满足条件,继续执行该循环,而不执行下面的命令
        fi

        echo -n "$i "
        let "temp2=m%7"
        if [ $temp2 -eq 0 ];then
                echo ""
        fi
        let "m++"
done

[root@server100 shell]# ./continue.sh
7 14 21 28 35 42 49
56 63 70 77 84 91 98

本文出自 “8176010” 博客,谢绝转载!

你可能感兴趣的:(continue,循环)