Wi-Fi strength graph in the console

After learning about spark by Zach Holman, and reviewing some of the examples, I wrote up this little bash helper function for showing wi-fi strength in the console.

# objective:
# type wifi in the console and get a pretty little graph of your current wifi strength
# usage:
# > wifi
# output:
# ▁▃▅█  59

# first install spark
brew install spark

# add this alias to your ~/.zshrc file
alias airport='/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/bin/airport'

# add this function to your ~/.zshrc (or external function) file
wifi () {
  if [ $(ifconfig en0 | grep UP | wc -l) -eq 1 ]
   then
     _linkQual="`airport -I | grep agrCtlRSSI | cut -d':' -f2 | sed 's/-//g'`"

     if [ $_linkQual -gt 52 ] # >75% link qual
     then
       _linkSparked=$(spark 1 2 3 4)
     elif [ $_linkQual -gt 35 ] # >50% link qual
     then
       _linkSparked=$(spark 1 2 3 0)
     elif [ $_linkQual -gt 17 ] # 25% link qual
     then
       _linkSparked=$(spark 1 2 0 0)
     elif [ $_linkQual -gt 7 ] # 25% link qual
     then
       _linkSparked=$(spark 1 0 0 0)
     else # < 25%
       _linkSparked=$(spark 0 0 0 0)
     fi

     echo $_linkSparked $_linkQual
   fi
}

Credit: Example by @cryptix