Here you can see the simple and easy way to check your PC able to ping particular IP.
SCRIPT:
SCRIPT:
#!/bin/bash
ping -c 3 $1 > /dev/null
if [[ $? -eq 0 ]]
then
echo "ping success"
else
echo "ping failed"
fi
if [[ $? -eq 0 ]]
then
echo "ping success"
else
echo "ping failed"
fi
OUTPUT:
i)
run -> ./ping.sh 192.168.1.4
ping success
ii)
run -> ./ping.sh 10.10.62.1
ping failed
No comments:
Post a Comment