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 Message-ID: <01da01c427e1$9dd085b0$66fda287@docbill002> From: "Bill C. Riemers" To: "Hannu E K Nevalainen" , References: Subject: Re: how to get IP with a shell command? Date: Wed, 21 Apr 2004 16:45:13 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes > The ipconfig stuff isn't much more reliable, depending on your setup. > I always have TWO IP's when my PPP/ISDN is up: > > $ ipconfig /all You could try using the "route print" command as well. i.e. Maybe something like: route print |expand |sed -n -e "s,.* $(route print|expand|sed -n -e 's,[.],[.],g' -e 's,^Default Gateway: *,,p') *\([0-9][0-9.]*\) *[0-9][0-9]*,\\1,p" But if you are behind a NAT, that probably won't give you what you really want either... A more elegant solution is to use dynamic dns. For example I use the following script run from my crontab: #!/bin/sh cd /tmp;exec wget --delete-after http://freedns.afraid.org/dynamic/update.php?KSD1ADSFLIjkseS11Dc= This automatically updates a dynamic DNS on afraid.org. Then even when I'm connected via WIFI across two separate NAT routers, I can still use my dynamic DNS name. Bill -- 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/