Changing OS X Location from the command line

Fletch on 2004-03-26T12:58:03

Found out about scselect yesterday from here. A couple of minutes effort on the train and I now can change from a shell without having to mouse up to the apple menu.

zsh++

##
## _scselect -- Completion for OS X Network Location utility
##
_scselect () {
    local locs
    locs=( $( scselect |& \
              perl -lne 'next if/^\S/;/\(([^)]+)\)/&&print qq{"$1"}' ) )
    _arguments -C "*:Network Location Set:($locs)"
}