Re: Utility to get IP address of the machine

2006-01-05 Thread Bernhard Ege
Andrew DeFaria wrote: Dave Korn wrote: Why not the more simple: ipconfig | grep "IP Address" | awk '{print $NF}' Because that may return more than one result. And it doesn't choose the one with the lowest metric, which is most likely to be the primary gateway to the world-at-large. By

Re: Utility to get IP address of the machine

2006-01-05 Thread Andrew DeFaria
Dave Korn wrote: Why not the more simple: ipconfig | grep "IP Address" | awk '{print $NF}' Because that may return more than one result. And it doesn't choose the one with the lowest metric, which is most likely to be the primary gateway to the world-at-large. By and large most people hav

Re: Utility to get IP address of the machine

2006-01-04 Thread Joe Smith
David said: Probably useless if you're behind any kind of NAT device. Unless you need the external ip address. Sometimes you need the internal address, but other times you need the external address. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports:

RE: Utility to get IP address of the machine

2006-01-04 Thread Frier, David
Probably useless if you're behind any kind of NAT device. --David -Original Message- From: Jon A. Lambert [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 04, 2006 8:17 To: cygwin@cygwin.com Subject: Re: Utility to get IP address of the machine Alex Vinokur wrote: > What i

Re: Utility to get IP address of the machine

2006-01-04 Thread Jon A. Lambert
Alex Vinokur wrote: What is Cygwin utility to get IP address of the machine? Here's another way to get the IP of your machine, from outside your network. ruby -ropen-uri -e "URI.parse('http://www.whatismyip.com').read =~ /((\d+\.?){4})/; puts $&" -- J Lambert -- Unsubscribe info: h

Re: Utility to get IP address of the machine

2006-01-04 Thread Peter J. Acklam
Herb Martin wrote: > While it is almost always more useful to use "Ipconfig > /all" when working interactively, when one just wants the > IP addresses just using plain "ipconfig" gets them without > so much noise to parse through. Or perl -MSocket -MSys::Hostname -wle \ 'print inet_ntoa

RE: Utility to get IP address of the machine

2006-01-04 Thread Dave Korn
Andrew DeFaria wrote: > Bernhard Ege wrote: > -- > It's lonely at the top, but you eat better. > >> I use my getip.sh script (windows xp): >> >> #!/bin/bash >> # find default gateways >> # select the one with the lowest metric >> ip=`route print | egrep "^ +0.0.0.0 +0.0.0.0 +" | gawk 'BEGIN { >>

Re: Utility to get IP address of the machine

2006-01-03 Thread Andrew DeFaria
Bernhard Ege wrote: -- It's lonely at the top, but you eat better. I use my getip.sh script (windows xp): #!/bin/bash # find default gateways # select the one with the lowest metric ip=`route print | egrep "^ +0.0.0.0 +0.0.0.0 +" | gawk 'BEGIN { metric=255; ip="0.0.0.0"; } { if ( $5 < metric )

RE: Utility to get IP address of the machine

2006-01-03 Thread Herb Martin
> If you don't care /which/ one, you can just hard-code > "127.0.0.1" ;-) but I > think that's probably not the answer you're looking for. > > You may need to parse the output from the windows "ipconfig /all". > > cheers, > DaveK While it is almost always more useful to use "Ipco

Re: Utility to get IP address of the machine

2006-01-03 Thread Bernhard Ege
Alex Vinokur wrote: What is Cygwin utility to get IP address of the machine? I use my getip.sh script (windows xp): #!/bin/bash # find default gateways # select the one with the lowest metric ip=`route print | egrep "^ +0.0.0.0 +0.0.0.0 +" | gawk 'BEGIN { metric=255; ip="0.0.0.0"; } { if ( $

RE: Utility to get IP address of the machine

2006-01-03 Thread Dave Korn
Alex Vinokur wrote: > What is Cygwin utility to get IP address of the machine? A machine can have many IP addresses, one for each network interface. If you don't care /which/ one, you can just hard-code "127.0.0.1" ;-) but I think that's probably not the answer you're looking for. You may