I am using a raspberry pi to run a BASH program and return a message indicating if the IP address is up or down. Any help with this would be much appreciated.
Thank you
I am using a raspberry pi to run a BASH program and return a message indicating if the IP address is up or down. Any help with this would be much appreciated.
Thank you
Most *nix commands will return a code of '0' for 'good' and non-zero for 'there is a problem' - you might try:
MSG="Ping up"
IP="a.b.c.d"
ping ${IP}
if [[ $? -ne 0 ]] ; MSG="Ping down" ; fi
echo "Status for ${IP}: ${MSG}"