Skip to content

Instantly share code, notes, and snippets.

@davidraviv
Created June 9, 2014 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidraviv/2ad3f6c6d409e0d111fc to your computer and use it in GitHub Desktop.
Save davidraviv/2ad3f6c6d409e0d111fc to your computer and use it in GitHub Desktop.
Get a list of your ip's on macosx using ifconfig (no external service)
#! /bin/bash
ip_lines=`ifconfig | grep "inet "`
prefix="*inet "
suffix=" net*"
while read -r line; do
ip=${line##$prefix}
ip=${ip%%$suffix}
echo "$ip"
done <<< "$ip_lines"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment