I obviously have a big hole in my UNIX knowledge on this one.
In a Bourne shell script I want to ping a hostname to see if it is there. I know I can do it this way:
...and then grep for "alive" etc.
I cannot find\remmeber how to get the return value. I want to use it like this:
What is the character that I need that will have the return value of ping?
Thanks,
Michael42
In a Bourne shell script I want to ping a hostname to see if it is there. I know I can do it this way:
Code:
STATUS=`ping $HOSTNAME`
echo $STATUS
...and then grep for "alive" etc.
I cannot find\remmeber how to get the return value. I want to use it like this:
Code:
ping $HOSTNAME
if [ <what goes here> -ne 0 ];
echo "Host not available."
fi
What is the character that I need that will have the return value of ping?
Thanks,
Michael42