Created
January 8, 2014 20:40
-
-
Save coderofsalvation/8324215 to your computer and use it in GitHub Desktop.
returns 0 if parameter is a valid network interface, 1 otherwise
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
# returns 0 if parameter is a valid network interface, 1 otherwise | |
function isvalidinterface() | |
{ | |
[ -z "$1" ] && return 1 | |
ip addr show | grep "$1": >/dev/null && return 0 | |
return 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment