IP ping bash test
1 min readJan 23, 2016
Check host availability by using ping in bash/shell script command line
#!/bin/sh
# -q quiet
# -c nb of pings to perform
ping -q -c5 google.com > /dev/null
if [ $? -eq 0 ]
then
echo "ok"
fi
Wait for the “ok” to echo. No echo, no host.
Alternatively, try this:
ping 256.256.256.256 ; echo $?
Viel Glück
— CCHGF