自動判斷局域網內在線的主機數目

            自動判斷局域網內在線的主機數目bash

目的:自動查詢局域網內在線的主機數目。ide

#!/bin/bashspa

for I in {1..254};doit

  if ping -c1 -W 1 192.168.6.$I &>/dev/null;thenclass

      echo "the host 192.168.6.$I is exist"查詢

  else di

     echo "the host 192.168.6.$I is not  exist"view

fi ping

trap 'exit' SIGINTvi

done 

相關文章
相關標籤/搜索