嗨,我正在尝试制作一个小脚本 我想从一定数量的ping到我的子网,直到另一个特定号码为例 但2美元和3美元无法正常工作。任何想法?
code:
#!/bin/bash
while [ $# -lt 9000 ]
do
case "$1" in
-$2-3) for i in 192.168.1.{$2..$3];do if ping -c1 -w1 &>/dev/null;then echo $i this one is up;fi; done
shift shift;;
-a) echo "hey just something random
esac
done
和输出类似,例如
letstrythisbash.sh 65-74
192.168.1.65这个上升了 192.168.1.69这个上升了 192.168.1.72这个是
答案 0 :(得分:2)
您需要查看seq
command:
themel@kallisti: ~ $ for i in $(seq 69 73) ; do echo $i is a number ; done
69 is a number
70 is a number
71 is a number
72 is a number
73 is a number