采用for循环来查找倍数,如果余数为0则是7的倍数直接输出 #!/bin/bash for (( i=0; i<=500; i++ )) do if [ ((iecho((i%7)) == 0 ]; then echo {i} fi done