On Wednesday 22 June 2005 11:42, Andrea Ganduglia wrote: > On 6/21/05, Valeriu Cerchez <[EMAIL PROTECTED]> wrote: > > I'm trying to find out a(/n easy) way to determine > > what is my dynamic IP assigned by my ISP (not my > > internal DHCP). I wish to make a script to determine > > that by request. > > > > I would greatly appreciate any suggestion. > > Thanks, Val. > > Surely possible way is: > ifconfig | grep -1 ppp0 | tail -1 | sed 's/.*r://' | sed 's/ .*$//' > > Replace ppp0 with your active interface.
And, ifconfig eth0 | grep inet | awk '{print $2}' | awk -F : '{print $2}' The bash var substitution (Johnson) is promising; I'll have to try that. (The exact one provided fails on ipv6 enabled ifconfig--notably all of Ubuntu--but once working, looks neater than the sed greps awk and does curls. (Though, OpenBSD might not like it as much as the sed greps awk deal.)
pgp6ijbwr3OXP.pgp
Description: PGP signature