Bash Script to check if a host is alive

Script to check if a host is alive:

#!/bin/bash
ping -c 2 www.amitnepal.com > /dev/null
if [ $? -eq 0 ]; then
echo "Alive";
else
echo "Dead";
fi

You may also like...