最近在学习shell 编程,闲来无事,搞了一个小shell. 可以用来 对一个网段的存活主机进行 探测。
#!/bin/bash
#
#date://
#blog:www.cnblogs.com/outline
#by :Joe if [ $# -lt ] ; then
echo " err, usage: ping.sh ARg "
echo " eg : ping.sh 192.168.1"
exit
fi ips="$1"
stat=
for ip in $(seq )
do
ping -c ${ips}.${ip} >/dev/null && stat= || stat=
if [ $stat -eq ];then
echo " $ips.$ip is up" fi
done if [ $stat -eq ]; then
echo " no host up"
fi
.