#!/bin/bash
pingserver=192.168.1.11
pingcmd()
{
ping -w 1 -c 1 $pingserver >/dev/null
result=`ping -w 1 -c 1 $pingserver|grep -q "ttl" && echo 0 ||echo 1`
return $result
}
pingcmd
ret=$?
if [ $ret -eq 1 ]
then printf "$pingserver is down"
fi