cmyip

Tuesday, June 5, 2012 Posted by Unknown
EDIT: They changed the way the numbers are encoded. See updated post: http://blog.init6.me/2012/11/update-cmyip.html


Just a little script that will echo back your current public IP address. Nice for when you are on a terminal and don't want to fire off any text browsers. etc.

#!/bin/bash
ip_addr=`curl -s http://cmyip.com | grep -o -E '[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}'`
echo $ip_addr


Labels:

Post a Comment