Good afternoon,
im playing around with bash and wanted to write a script that would perform a traceroute and check if the second hop was a specific IP address. below is my script:
Failover_check= traceroute 8.8.8.8 -n | grep 192.168.0.2 | awk '{print $2;}'
if [ $Failover_check = "192.168.0.2" ]
then
echo "ip found"
else
echo "ip not ound"
fi
every time I run the script it always hits the else statement
Thanks