Hi can anyone help, looking to see if anyone knows how to give me an ip address back from a ping on sun, as it just says alive:
I am wanting to test printers on the system
#!/bin/ksh
###### Script to Test remote printers are working ###########################
for n in `pg /etc/printers.conf | grep :bsdaddr | awk -F= '{print $2}' | awk -F, '{print $1}'`
do
A=`ping -c 1 $n 2>/dev/null`
if [ -z "$A" ]; then
B="NOTFOUND"
else
B=`echo "$A" | grep packet | awk '{print $(NF-2)}'`
fi
if [ $B = "100%" ]; then
echo $n FAILED
elif [ $B = "0%" ]; then
echo $n OK
else
echo $n NOT FOUND
fi
done
##### NF=Number of Fields
this -c 1 works great with AIX , but cant find syntax to work on Sun. Any ideas
I am wanting to test printers on the system
#!/bin/ksh
###### Script to Test remote printers are working ###########################
for n in `pg /etc/printers.conf | grep :bsdaddr | awk -F= '{print $2}' | awk -F, '{print $1}'`
do
A=`ping -c 1 $n 2>/dev/null`
if [ -z "$A" ]; then
B="NOTFOUND"
else
B=`echo "$A" | grep packet | awk '{print $(NF-2)}'`
fi
if [ $B = "100%" ]; then
echo $n FAILED
elif [ $B = "0%" ]; then
echo $n OK
else
echo $n NOT FOUND
fi
done
##### NF=Number of Fields
this -c 1 works great with AIX , but cant find syntax to work on Sun. Any ideas