Relative Content

Tag Archive for bash

Do ping only if interface has ip and link detected

I’ve got the below script, what i’m trying to do is if both the interface has an ip AND link detected then do a ping BUT if interface doesn’t have an ip OR link isn’t detected then echo ping fail. But for some reason even when interface is down i still don’t get “ping fail”