• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Get IP
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get IP


  • Subject: Re: Get IP
  • From: Ian Mcginley - Systems Support Engineer <email@hidden>
  • Date: Mon, 27 Oct 2003 08:33:33 +1100

Well Somewhere long the lines someone messed up my do shell script which you are quoting.

the grep 'inet' section will machine both your inet and inet6 (IPv6) addresses. As IPv6 is (typically) a derivative of your MAC address (or ethernet address) then it is static whether your Apple Mac is connected to the network or not. This is a valid case for both en0 (onboard cable network) and en1 (airport) connections.

The actual do shell script I instructed was:

do shell script "/sbin/ifconfig en0 | grep 'inet ' | awk '{print $2}'"

Now notice the space after inet in the single quotes. Thats very important. That means if you look at the ifconfig output for en0 it won't match inet6 - which grep 'inet' will match.

More importantly, your version of the do shell script does not even need the single quotes. The quotes were only inserted to make sure that the space was included in the grep string.

Hopefully that helps with your understanding about what is going on.

Regards,
Ian

DigitEL wrote:

Thanks All for the replies. Sure enough I do have an Airport card active on my tibook, so I guess its a repeat routine until something parses out as an octet ip.


On Friday, Oct 24, 2003, at 14:39 America/Vancouver, Jon Pugh wrote:

At 1:13 PM -0700 10/24/03, DigitEL wrote:

(do shell script "ifconfig en0 | grep 'inet' | awk '{print $2}'")


Can someone illuminate why all these shell script calls only work on my machine if set to 'en1'?
Using 'en0' brings back a lot of info but does not contain a IP addresses.


There are a number of Ethernet interfaces on each machine. There's the built-in Ethernet, and the airport Ethernet. If you add Ethernet cards, you'll get en2, en3, etc.

Of course, the assignment of en0, en1, etc. is arbitrary, or at least controlled by what network setup the user has defined and is using. For example, both en0 and en1 are active on my machine currently, but when used in the office, the wired Ethernet is active and at home the wireless Ethernet is active.

So, you probably should check them all until you get one that is working.

Jon
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


Thanks
EL
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


--
Ian McGinley
Systems Support Engineer Sun Microsystems Australia
476 St Kilda Road - Melbourne - Australia - 3004
Ph: (03) 8866 6360 Email: email@hidden

UNIX is user-friendly, it is just picky about its friends
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Get IP (From: DigitEL <email@hidden>)

  • Prev by Date: Re: Eudora AppleScript Question...
  • Next by Date: Programming the address book
  • Previous by thread: Re: Get IP
  • Next by thread: Replace_chars Subroutine just doesn't work for me
  • Index(es):
    • Date
    • Thread