Created
December 8, 2013 17:40
-
-
Save dualbus/7860779 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ip -o addr \ | |
| awk ' | |
$2 ~ /:$/ { | |
i=$2; | |
sub(/:$/,"",i); | |
status[i]=$9 | |
} | |
$3 == "inet" { | |
ipv4_address[$2]=$4 | |
} | |
END { | |
general_status=0 | |
for(interface in status) { | |
if(status[interface] == "UP") { | |
general_status++; | |
print interface; | |
} | |
} | |
exit(! general_status); | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment