Dynamically set network location in Mac OS X
I love macs, but sometimes things could have been implemented better. In particular, I hate having to set the network location on my laptop when I go between work and home every day. I have put together a small shell script which can do this. I run this script on startup and it just checks what day and time it is so it can switch between two profiles (work or home).
#!/bin/bash
day=`date +"%a"`
hour=`date +"%H"`
if [ $day = "Sat" -o $day = "Sun" ]; then
`scselect Home`
else
if [ $hour -gt 8 -a $hour -lt 16 ]; then
`scselect Work`
else
`scselect Home`
fi
fi
exit 0