[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to get an IP address



On Mon, 14 Nov 2011 16:44:48 +0000, T o n g wrote:

> I know how to get an IP address *info* using dig, but has anyone looked
> into how to get *only* the IP address? so that I can use, eg.
> 
>  the_ip=`get_ip host`

Not sure if this will be bulletproof but...

sm01@stt008:~$ host -t a google.com|head -n1|awk '{ print $4 }'
209.85.169.105

Greetings,

-- 
Camaleón


Reply to: