目的
查看局域网内在用的IP地址
代码
#!/bin/bash
for value in {1..255}
do
result=$(ping 192.168.9.${value} -c 2 | grep '100% packet loss')
if [[ ${result} == "" ]];then
t=$(date '+%Y-%m-%d %H:%M:%S')
echo ${t} 192.168.9.${value} >> ip.txt
fi
echo "process " 192.168.9.${value}
done
网友评论