#!/bin/bashbash
#edit by www.jbxue.comide
for a in {1..254} spa
doblog
if ping -w 1 -c 1 152.55.249.$a | grep "100%" >/dev/null get
thenit
echo "152.55.249.$a is Not reachable"io
elseclass
echo "152.55.249.$a is reachable"grep
fiim
done
解釋:-w表示時間一秒,-c表示ping1次,若是返回100%,則表示失敗輸入到then語句,不然輸入到else語句。
