Skip to content

Instantly share code, notes, and snippets.

@myles
Created January 2, 2010 22:22
Show Gist options
  • Save myles/267698 to your computer and use it in GitHub Desktop.
Save myles/267698 to your computer and use it in GitHub Desktop.
#!/bin/sh
myen0=`ifconfig en0 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`
myen1=`ifconfig en1 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`
wip=`/usr/bin/curl --silent http://checkip.dyndns.org | awk '{print $6}' | cut -f 1 -d "<"`
INACTIVE='INACTIVE'
if [ "$myen0" != "" ]
then
echo "Ethernet: $myen0"
else
echo "Ethernet: $INACTIVE"
fi
if [ "$myen1" != "" ]
then
echo "Wireless: $myen1"
else
echo "Wireless: $INACTIVE"
fi
if [ "$wip" != "" ]
then
echo "External: $wip"
else
echo "External: $INAVTIVE"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment