檢查主機pingshell是否暢通
檢查主機pingshell是否暢通
#。/bin/bash。#2013-10-21。#ping檢測網絡是否暢通。set-u;#set-x;ping_fun(){。d_network=192.168.1。echo-n";inputthenetwork(default$d_network):"。readnetwork。:${network:=$d_network}。echo";network:$network"。d_hostip_beg=1。d_hostip_end=254。echo-n";inputthehostip(default$d_hostip_beg$d_hostip_end):"。readhostip_beghostip_end。
導讀#。/bin/bash。#2013-10-21。#ping檢測網絡是否暢通。set-u;#set-x;ping_fun(){。d_network=192.168.1。echo-n";inputthenetwork(default$d_network):"。readnetwork。:${network:=$d_network}。echo";network:$network"。d_hostip_beg=1。d_hostip_end=254。echo-n";inputthehostip(default$d_hostip_beg$d_hostip_end):"。readhostip_beghostip_end。
![](https://img.51dongshi.com/20250105/wz/18528826552.jpg)
系統大全為您提供#!/bin/bash#2013-10-21#ping檢測網絡是否暢通set-u#set-xping_fun(){d_network=192.168.1echo-n"inputthenetwork(default$d_network):"readnetwork:${network:=$d_network}echo"network:$network"d_hostip_beg=1d_hostip_end=254echo-n"inputthehostip(default$d_hostip_beg$d_hostip_end):"readhostip_beghostip_end:${hostip_beg:=$d_hostip_beg}:${hostip_end:=$d_hostip_end}echo"hostip_beg:$hostip_beg"echo"hostip_end:$hostip_end"count=1up_host='正常IP:';for((hostip=$hostip_beg;hostip<=$hostip_end;hostip++));dohost=$network.$hostipecho"開始ping檢測$host"ping-c$count$host&>/dev/nullif[$?=0];thenecho"IP$host是正常的"up_host="$up_host$host"elseecho"IP$host是不正常的"fidoneecho$up_host;exit0}?echo"----開始執行ping程序----"ping_fun以上就是系統大全給大家介紹的如何使的方法都有一定的了解了吧,好了,如果大家還想了解更多的資訊,那就趕緊點擊系統大全官網吧。本文來自系統大全http:///如需轉載請注明!推薦:win7純凈版
檢查主機pingshell是否暢通
#。/bin/bash。#2013-10-21。#ping檢測網絡是否暢通。set-u;#set-x;ping_fun(){。d_network=192.168.1。echo-n";inputthenetwork(default$d_network):"。readnetwork。:${network:=$d_network}。echo";network:$network"。d_hostip_beg=1。d_hostip_end=254。echo-n";inputthehostip(default$d_hostip_beg$d_hostip_end):"。readhostip_beghostip_end。
為你推薦