Utility to get IP address of the machine

Andrew DeFaria Andrew@DeFaria.com
Thu Jan 5 10:01:00 GMT 2006


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 have but 1 IP address but if you must tack on a 
"| head -1". YMMV
-- 
I had a dream that all the victims of The Pill came back...boy, were 
they mad!!



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list