Skip to content

Instantly share code, notes, and snippets.

@devnore
Created December 20, 2013 22:41
Show Gist options
  • Save devnore/8062797 to your computer and use it in GitHub Desktop.
Save devnore/8062797 to your computer and use it in GitHub Desktop.
List all IPs in OSX internal and external
#!/bin/bash
echo -e "\033[1mExternal:\033[0m $(wget -q -t 5 --output-document=- "http://dyndns.ispy.se/")"
Interfaces=`ifconfig -a | grep -o -e "^[a-z][a-z]*[0-9]" | perl -pe "s|^([a-z]*[0-9]*)[ ]|\1|"`
for Interface in $Interfaces; do
INFO=`ifconfig $Interface 2>&1`
if grep -q "status: active" <<<$INFO; then
echo -e "\033[1m$Interface:\033[0m $(ipconfig getifaddr $Interface)"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment