#!/usr/bin/env bash if [[ ! -d /sys/class/net/${interface}/wireless ]] || [[ "$(cat /sys/class/net/$interface/operstate)" = "down" ]]; then exit fi DATA=$(grep $interface /proc/net/wireless) IFS=" " read -r -a DATA <<< "$DATA" QUALITY=$(echo "${DATA[2]}*100/70" | bc) echo "$QUALITY%" echo "$QUALITY%" if [[ $QUALITY -ge 80 ]]; then echo "#98971a" elif [[ $QUALITY -lt 80 ]]; then echo "#D79921" elif [[ $QUALITY -lt 60 ]]; then echo "#FFAE00" elif [[ $QUALITY -lt 40 ]]; then echo "#FF0000" fi