The additional character in 10.10 has broken another script we use, but I'm not sure how to fix this one due to my limited scripting skills. I tried to remove the if statements referring to OS type since we have nothing older than 10.7 in use, and even they will be gone shortly, but I just ended up breaking the script in different ways.
The unmodified script that breaks on 10.10:
#!/bin/bash
AP_NAME="NETWORK"
AP_SEC="WPA2E"
INDX=0
AIRPORT=""
ALLINTERFACES=""
IFS='
'
SW_VER=`/usr/bin/sw_vers -productVersion`
if [ `echo "if(${SW_VER%.*}>=10.7)r=1;r"|/usr/bin/bc` -eq 1 ]; then
APNAME="Wi-Fi"
else
APNAME="AirPort"
fi
#
# Look for AirPort interface
#
for intf in `/usr/sbin/networksetup -listnetworkserviceorder | grep "^(H"`; do
IFS=':,)'
set $intf
if [[ ($2 =~ ${APNAME} ) ]]; then AIRPORT=$4; fi
done
if [ `echo "if(${SW_VER%.*}>=10.6)r=1;r"|/usr/bin/bc` -eq 1 ]; then
RM_AP_CMD="/usr/sbin/networksetup -removepreferredwirelessnetwork ${AIRPORT} ${AP_NAME}"
ADD_AP_CMD="/usr/sbin/networksetup -addpreferredwirelessnetworkatindex ${AIRPORT} ${AP_NAME} ${INDX} ${AP_SEC}"
else
RM_AP_CMD="/usr/sbin/networksetup -removepreferredwirelessnetwork ${APNAME} ${AP_NAME}"
ADD_AP_CMD="/usr/sbin/networksetup -addpreferredwirelessnetworkatindex ${APNAME} ${AP_NAME} ${INDX} ${AP_SEC}"
fi
# Remove Existing WiFi Profile
profileTest=$(/usr/bin/profiles -C -v | /usr/bin/awk -F: '/profileIdentifier: com.domain.network/{print $NF}')
if [ -n "$profileTest" ]; then
echo "Found WiFi Profile installed."
echo "Removing existing WiFi Profile"
/usr/bin/profiles -R -v -p com.domain.network -z Tw0wMQWKy123
fi
# Remove Wireless LAN from Preferred List
echo "Removing Wireless LAN $AP_NAME from Preferred List"
eval ${RM_AP_CMD}
# Add Wireless LAN to the Preferred List
echo "Adding Wireless LAN $AP_NAME to Preferred List"
eval ${ADD_AP_CMD}
Thanks for any tips and guidance!
-Bob
