seq 设置起始增量

最后更新于:2022-04-02 03:53:47

[TOC] ## seq 设置起始增量 ``` #!/bin/bash PREFIX=192.168.1. for i in `seq 100 110` do echo -n "${PREFIX}$i " ping -c5 ${PREFIX}${i} >/dev/null 2>&1 if [ "$?" -eq 0 ];then echo "OK" else echo "Failed" fi done ``` 执行 ``` jelly@X:~$ bash ping.sh 192.168.1.100 Failed 192.168.1.101 Failed 192.168.1.102 OK 192.168.1.103 OK 192.168.1.104 OK 192.168.1.105 OK 192.168.1.106 Failed 192.168.1.107 Failed 192.168.1.108 Failed 192.168.1.109 Failed 192.168.1.110 Failed ```
';