[X-Unix] Getting global IP address
    Jeff Winchester 
    jeffw at tampabay.rr.com
       
    Sat Nov 27 11:08:01 PST 2004
    
    
  
On Nov 25, 2004, at 8:21 AM, Mark Philip wrote:
> But is there a way to do it via the command line and not via the web?
But of course. :)
I use this little bash script. It does assume that you have Lynx 
installed ("fink install lynx" if you don't). You could just as easily 
use curl or wget instead; I found this one on the 'net and was a bit 
too lazy to write my own.
-----
#!/bin/bash
url="whatismyip.com"
echo ""
/sw/bin/lynx --nocolor --dump $url | head -10 |  grep "Your IP" |  awk 
'{print $4}'
echo ""
-----
-- 
Jeff Winchester
jeffw at tampabay.rr.com
    
    
More information about the X-Unix
mailing list