自動判斷局域網內在線的主機數目
目的:自動查詢局域網內在線的主機數目。
#!/bin/bash
for I in {1..254};do
if ping -c1 -W 1 192.168.6.$I &>/dev/null;then
echo "the host 192.168.6.$I is exist"
else
echo "the host 192.168.6.$I is not exist"
fi
trap 'exit' SIGINT
done
自動判斷局域網內在線的主機數目
目的:自動查詢局域網內在線的主機數目。
#!/bin/bash
for I in {1..254};do
if ping -c1 -W 1 192.168.6.$I &>/dev/null;then
echo "the host 192.168.6.$I is exist"
else
echo "the host 192.168.6.$I is not exist"
fi
trap 'exit' SIGINT
done