Skip to content

Instantly share code, notes, and snippets.

@rjocoleman
Created July 26, 2013 00:46
Show Gist options
  • Save rjocoleman/6085150 to your computer and use it in GitHub Desktop.
Save rjocoleman/6085150 to your computer and use it in GitHub Desktop.
ip() {
local WIFI=`ipconfig getifaddr en0 2> /dev/null`
local ETHERNET=`ipconfig getifaddr en1 2> /dev/null`
local EXT=`curl -s http://checkip.dyndns.org/ | grep -o '[0-9][0-9]*.[0-9][0-9]*.[0-9][0-9]*.[0-9]*'`
if [ "$ETHERNET" != "" ]; then
echo -n -e "Ethernet:\t "
echo -e $ETHERNET
fi
if [ "$WIFI" != "" ]; then
echo -n -e "Wifi:\t\t "
echo -e $WIFI
fi
echo -n -e "External:\t "
echo -e $EXT
echo -e $EXT | pbcopy
echo ""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment