X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Andrew DeFaria Subject: Re: Utility to get IP address of the machine Date: Thu, 05 Jan 2006 02:01:32 -0800 Lines: 15 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) In-Reply-To: X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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/