This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Utility to get IP address of the machine


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]