- #!/bin/bash
- read -p "Please keyin the network segment: (e.g. 10.88.1) " farm
- for i in `seq 2 255`
- do
- ip="$farm.$i"
- ping -c 3 $ip &> /dev/null
- if [ $? -eq 0 ];then
- echo "$ip is on line"
- else
- echo "$ip is not on line"
- fi
- done
- #该片段来自于http://www.codesnippet.cn/detail/2108201513510.html
来源: http://www.codesnippet.cn/detail/2108201513510.html