Created
February 27, 2013 14:58
-
-
Save steve-taylor/5048501 to your computer and use it in GitHub Desktop.
Assign the name of the Internet facing network interface to a variable in a shell script. Requires Internet access.
This file contains 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 | |
IPADDR=`wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'` | |
NIC=`ip addr show | grep $IPADDR | awk '{ print $(NF) }'` | |
# Rest of your script here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment