title: A script to toggle WiFi in MacOS
body: <p>I'm trying to write a script that toggles WiFi on or off.</p>
  
  <p>I'm having trouble with the "if" statement. I'm starting with a simple script that should tell you if Wifi is on or off. It doesn't work as written. I get "Wifi is off" no matter what the WiFi status is</p>
  
  <pre><code>#!/bin/sh
  STATUS=`networksetup -getairportpower en0`
  if $STATUS == On
  then
     echo "Wifi is on"
  else
      echo "Wifi is off"
  fi
  </code></pre>