Changed ip function to use bash-it's func, parsing out 127.0.0.1

Attached public facing ip address to list
pull/54/head
Ryan Kanno 2011-06-09 13:20:41 -10:00
parent b96345e00c
commit 49f897ae0d
1 changed files with 5 additions and 2 deletions

View File

@ -73,11 +73,14 @@ MAX_PWD_LENGTH=20
# Max length of Git Hex to display # Max length of Git Hex to display
MAX_GIT_HEX_LENGTH=5 MAX_GIT_HEX_LENGTH=5
# IP address
IP_SEPARATOR=', '
# FUNCS ======================================================================= # FUNCS =======================================================================
# TODO: Should check with `uname` and use ip addr
function ip { function ip {
echo -e $(ifconfig en1 | grep "inet " | awk '{ print $2 }') myip=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+')
echo -e "$(ips | sed -e :a -e '$!N;s/\n/${IP_SEPARATOR}/;ta' | sed -e 's/127\.0\.0\.1\${IP_SEPARATOR}//g'), ${myip}"
} }
# Displays virtual info prompt (virtualenv/rvm) # Displays virtual info prompt (virtualenv/rvm)