Last active
May 7, 2019 02:31
-
-
Save o0-o/a95c501b7e626b0e4bfb767149e1a3dc to your computer and use it in GitHub Desktop.
[Network Interfaces] Prints network interfaces #Shell
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
# net_if.sh | |
( # linux | |
file /sys/class/net/* | | |
sed 's/.*\///g' || | |
# macos | |
networksetup -listallhardwareports | | |
grep "Device:" | | |
awk '{ print $2 }' || | |
# bsd | |
ifconfig -l ether | | |
tr " " "\n" | |
) 2>/dev/null || | |
exit 1 #fail | |
exit 0 #success |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment