Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

aploogies for the simple question

Status
Not open for further replies.

Scunningham99

Programmer
Sep 20, 2001
815
GB
i am trying to get ping command in script to work. i wish to test the result either 1 or 0 for success.

However whenever i try and put the command in ` ` it does not understand. the host i am trying to ping is called oracle.

neither work

#!/bin/ksh

test `ping oracle`

echo $1

or -----------------------------------------------

#!/bin/ksh

[`ping oracle`]

echo $1

ping oracle works fine, however i want to test he condition. Does anyone know where i am going wrong!!

Any help would be greatly appreciated..

Sy
 
.....and test the result, rather than your command, ie:

ping oracle
result=$?

if [ result = 1 ]
then
echo 'ping failed'
else
echo 'ping succeeded'
fi

Might work?
 
cheers typo dont know ehy i was using a 1...

thanks for ur help ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top