Re: dd: IP address via Terminal
Re: dd: IP address via Terminal
- Subject: Re: dd: IP address via Terminal
- From: RR <email@hidden>
- Date: Tue, 26 Feb 2002 12:08:33 -0500
Dave, the problem with the IP address of the current computer, is that a
computer can have multiple IP addresses, one for each adapter (e.g. I may
have both my hardwired Ethernet and my wireless Ethernet connections
active), and you could have many IP addresses aliased to one adapter.
Just trying to make sure you're aware of several combinations here.
But if we say that you know you want the IP for en0, you can get that with
a simple script:
EN0_IP=`ifconfig en0|grep inet|cut -d ' ' -f 2`
To get the list of all active adapters on the system, you can use
something like
INTERFACES=`netstat -ni|grep -v Name|cut -d ' ' -f 1|grep -v \*|uniq`
Good luck,
RR
On Tuesday, February 26, 2002, at 11:14 AM, dave wrote:
i'm trying to write a Terminal script that will return the IP address of
the current computer. i've managed to isolate my IP address using
netstat -i and/or netstat -r. how do i grab just the IP address from the
output?
if this is off-topic, i apologize, and request re-direct to appropriate
forum.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.