IP ping bash test

Constant Mori
1 min readJan 23, 2016

--

— *ping* … Hello? World?

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

--

--

Constant Mori

ML Research Scientist in Training ➖ @Hydraulophone @FCCagriculture Alumni➖ 🚲 glassexplorer ➖ 🖤 #ML #CNN #biosignals #sensors #labonachip #ubiquitouscomputing