Skip to content

Instantly share code, notes, and snippets.

@davidraviv davidraviv/ip.sh
Created Jun 9, 2014

Embed
What would you like to do?
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
You can’t perform that action at this time.