Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jrock2004

macrumors 6502
Original poster
The first part of the if statement is always coming true and it should not. If I run the wirelessStatus command in the terminal nothing comes up since wireless is enabled. What am I missing here? Thanks

Code:
wirelessSsid=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep -w 'SSID' | awk '{print $2}'`
wirelessStatus=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep -w 'AirPort' | awk '{print $2}'`
statusText='Off'

if [ $wirelessStatus=$statusText ]; then
    echo "Wireless SSID: Disabled"
else
    echo Wireless SSID: $wirelessSsid
fi
 
Try

Code:
if [ "$wirelessStatus" = "$statusText" ]; then

This seems to work when I do it:
Code:
bash-3.2$ test1=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep -w 'AirPort' | awk '{print $2}'`
bash-3.2$ echo $test1

bash-3.2$ if [ "$test1" = "$test2" ]; then echo "OK"; fi
bash-3.2$ test1=`/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep -w 'AirPort' | awk '{print $2}'`
bash-3.2$ echo $test1
Off
bash-3.2$ if [ "$test1" = "$test2" ]; then echo "OK"; fi
OK
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.