I have things in my .tcshrc that are run depending upon location context. At home I have some resources, at work I have others. I was using `hostname | cut -f 2- -d.` (because Darwin's domainname gives me a blank string) but recently I'm getting "mickey.local" whether I'm using my home or office networks (via DHCP).
A friend suggests I work through ifconfig, maybe pulling its inet or broadcast values, but that seems ugly.
What's the correct way to update network status when I switch Networks in the pref pane?
Conversely, is there a way to detect an Ethernet cable being inserted and cause Networks to switch automagically?