X-Spam-Check-By: sourceware.org X-T2-Posting-ID: scpomQ6OoLdFPJaiveQ0Zw== X-Cloudmark-Score: 0.000000 [] Message-ID: <43BD212A.3060201@ege.cc> Date: Thu, 05 Jan 2006 14:37:46 +0100 From: Bernhard Ege User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Utility to get IP address of the machine References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 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 and large most people have but 1 IP address but if you must tack on a > "| head -1". YMMV Perhaps, but if you ever use VPN, you have more than one network interface (one physical and one virtual). This was why I created my little script. Also, many new motherboard have 2 NICs and also a firewire port that also functions as a NIC. All in all, more than 1 network interface is not that uncommon (I have 4 on my pc but up to 3 on my laptop (NIC, wireless, VPN). Anyway, I gave my script to aid, not to start a discussion. Have fun ;-) Bernhard -- 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/