标签:linu windows The err lang bsp win null $?
linux版本
$ vi ping.txt
#!/bin/bash
for i in {1..255}
do
ping -c 3 -i 0.3 -W 3 10.0.50.$i &>/dev/null
if [ $? -eq 0 ] ; then
echo 10.0.50.$i>>sucess.txt
else
echo 10.0.50.$i>>fail.txt
fi
done
windows版本:
for /l %p in (1,1,254) do @ping -l 1 -n 3 -w 40 192.168.1.%p & if errorlevel 1 (echo 192.168.1.%p>>na.txt) else (echo 192.168.1.%p>>ok.txt)
标签:linu windows The err lang bsp win null $?
原文地址:https://www.cnblogs.com/xue-sfl/p/14129452.html