Problem: I have a bunch of “workflow” wrappers to svn, but I’ve foolishly hardcoded my svn server to svnserver.local, its name on the Bonjour network. So I go home, and on the same laptop I use at work, I have to do 86 extra steps to use my scripts. Wouldn’t it be great if the scripts knew how to figure out if I was at home?
Complication: Airport at home and office are configured essentially identically, so it’s not like I can just look at the IP address.
Solution:scselect! It’s important to note that calling it w/o options prints to STDERR not STDOUT. No idea why.
Anyway after some messing around with things I ended up with this:
scselect 2>&1 | egrep “\*” | tail -1 | awk ‘{print $3}’ | sed -e ’s/(//’ -e ’s/)//’
This returns the current network location. Configure (and switch to) the appropriate network location, and now my wrappers know which repository URL to use. Yay.
Now someone please tell me there’s an easier way ….




If I had to do this, I’d hardcode my SVN server as straight IP address or FQDN w/r/t the “internal” network. If at the office, it works OTB. From home, I’d connect through the VPN which should pull in the proper DNS settings, or make the IP available naturally. A single extra step: Connecting via VPN.