~~META:date created = 2010-05-03 16:24~~ ====== Make your Mac feel at Home ====== A small snippet from one of my scripts which tests whether your Mac is in the given (home) WLAN. # # Path to 'airport' executeable, as of Mac OS X 10.5. AIRPORT="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport" # # Set this to your Home WLAN SSID (name): HOMESSID="mycastle" # # Get SSID info from 'airport' and search for $HOMESSID SSID=$(${AIRPORT} --getinfo | grep ' SSID:') SSID=$(echo ${SSID} | grep "^SSID: ${HOMESSID}\$") # # Branch depending on grep's return code. if [ "$?" == "0" ]; then # in home wlan echo "home sweet home..." else # not at home echo "on the road again..." fi To use this code, set the ''HOMESSID'' to your ''SSID'' (the name of the wireless network) and replace the two echo lines with your code. {{tag>cli mac osx wlan sysadmin scripting}}