QUOTE:原帖由 ppiqq 于 2008-12-19 10:45 发表

#!/bin/sh
a=12
b=11
ip=192.168.0.231
function PING_STATUS ()
{ local _ipadd
_ipadd=$1
PING_COUNT=`ping -c 4 $1`
if [ $? -eq 0 ];then
return 0 #ping success
...
PING_STATUS $ip
if [[ $? -eq 0 && $a -gt $b ]];then
echo "test is ok"
elif [[ $? -ne 0 && $a -gt $b ]];then
echo "dfdfdfdf"
fi
复制代码
PING_STATUS $ip
ping=$?
if [[ $a -gt $b ]]; then
if [[ $ping -eq 0 ]];then
echo "test is ok"
elif [[ $ping -ne 0 ]]; then
echo "dfdfdfdf"
fi
fi
复制代码