The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




Thread: ping
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 12-12-2002
Kevin Pryke Kevin Pryke is offline
Registered User
  
 

Join Date: Feb 2002
Location: Bradford, UK
Posts: 70
To see if a ping has worked, check the return value ($?)

ie. something like
Code:
ping -c1 <server_name>
if [ $? -ne 0 ]
then
    echo "Not Found"
else
    echo "Found
fi
added code tags for readability --oombera

Last edited by oombera; 02-17-2004 at 03:12 PM..