From: Ryan Kanno Date: Thu, 9 Jun 2011 23:20:41 +0000 (-1000) Subject: Changed ip function to use bash-it's func, parsing out 127.0.0.1 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=49f897ae0def7ef26fe68570726cfb3804bb75c3;p=common%2Fbash_it.git Changed ip function to use bash-it's func, parsing out 127.0.0.1 Attached public facing ip address to list --- diff --git a/themes/hawaii50/hawaii50.theme.bash b/themes/hawaii50/hawaii50.theme.bash index 6202eb4..a86821c 100644 --- a/themes/hawaii50/hawaii50.theme.bash +++ b/themes/hawaii50/hawaii50.theme.bash @@ -73,11 +73,14 @@ MAX_PWD_LENGTH=20 # Max length of Git Hex to display MAX_GIT_HEX_LENGTH=5 +# IP address +IP_SEPARATOR=', ' + # FUNCS ======================================================================= -# TODO: Should check with `uname` and use ip addr 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)