Skip to content

Instantly share code, notes, and snippets.

@coderofsalvation
Created January 8, 2014 20:40
Show Gist options
  • Save coderofsalvation/8324215 to your computer and use it in GitHub Desktop.
Save coderofsalvation/8324215 to your computer and use it in GitHub Desktop.
returns 0 if parameter is a valid network interface, 1 otherwise
# 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