|
|
Retrieve network info from the command line
Regarding interface names, I find it helpful to list the network services available (that is, the names the user configures in System Preferences) and then associate them with an interface. I run the setup code in my .bash_profile. My scripts can then reference ${AirPort} to get en1 (on my system), or iterate through the list of active interfaces to obtain relevant data for the OS X Network Location in use.
This method has an additional benefit in that the interfaces are listed in priority order so you know which interface is getting tried first.
Here is some code that accomplishes that:
If you implement this in a Geeklet, you may have to source your bash_profile or copy the code into the Geeklet script as the .bash_profile is only read on a login invocation.
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.22 seconds |
|