Re: How to get an IP address

2011-11-15 Thread Bob Proulx
T o n g wrote: > Bob Proulx wrote: > >> . . . how to get *only* the IP address of my current > >> Intranet address 192.168...? > > Thanks for your answer Bob, > > > Or if you don't like loopback addresses showing up in the list: > > > > $ ip addr show | awk '/ inet / && !/127\./{print$2}' >

Re: How to get an IP address

2011-11-15 Thread Bob Proulx
T o n g wrote: > Now a related question, how to get *only* the IP address of my > current Intranet address 192.168...? > > Is there easier answers than analysing results from the following? > > ifconfig eth0 > ip addr > ip -f inet addr Please remember that hosts have devices and devices have

Re: How to get an IP address

2011-11-15 Thread Tom H
On Tue, Nov 15, 2011 at 5:02 AM, Chris Davies wrote: >> On Mon, Nov 14, 2011 at 11:44 AM, T o n g wrote: > Tom H 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 u

Re: How to get an IP address

2011-11-15 Thread Bob Proulx
Chris Davies wrote: > Fails for CNAME chains, sorry! > > $ dig +short www.bbc.co.uk > www.bbc.net.uk. > 212.58.246.94 > > (You could try dig +short ... | grep -v '\.$', but I've not tested that > exhaustively.) You might use the bind9-host 'host' command. $ host www.bbc.co.uk www.bbc.co.uk

Re: How to get an IP address

2011-11-15 Thread Chris Davies
> On Mon, Nov 14, 2011 at 11:44 AM, 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` Tom H wrote: > dig +short ... Fails for CNAM

Re: How to get an IP address

2011-11-14 Thread Tom H
On Mon, Nov 14, 2011 at 3:22 PM, Bob Proulx wrote: > > The 'getent' utility is part of GNU glibc and is present on any GNU > glibc based system but not present on others.  It won't work on HP-UX > for example. "getent" exists in Solaris. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.deb

Re: Re: How to get an IP address

2011-11-14 Thread Clive Standbridge
Bob Proulx wrote: > > The 'getent' utility is part of GNU glibc and is present on any GNU > glibc based system but not present on others. It won't work on HP-UX > for example. Certainly if you only care about GNU/Linux machines then > you should be safe using it. A good suggestion. That's good

Re: How to get an IP address

2011-11-14 Thread Bob Proulx
Clive Standbridge wrote: > Kind people have already suggested dig and host, 'dig' and 'host' are the portable way to look things up since those either already exist or can exist on any Unix-like system. > but may I make another suggestion: > >getent hosts $hostname | awk '{print $1}' > > It

Re: How to get an IP address

2011-11-14 Thread Clive Standbridge
> Hi, > > 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` Hi Tong, Kind people have already suggested dig and host, but may I make another suggestion: gete

Re: How to get an IP address

2011-11-14 Thread Camaleón
On Mon, 14 Nov 2011 16:44:48 +, 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

Re: How to get an IP address

2011-11-14 Thread Tom H
On Mon, Nov 14, 2011 at 11:44 AM, 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` dig +short ... -- To UNSUBSCRIBE, email to debian-user-requ...@l

How to get an IP address

2011-11-14 Thread T o n g
Hi, 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` Thanks -- Tong (remove underscore(s) to reply) http://xpt.sourceforge.net/techdocs/ http://xpt.sourceforge.net/tools/ -- To