#!/usr/bin/env bash # Find the first wireless interface connection_type=$(iw dev | awk '$1=="Interface"{print $2; exit}') #gets network type (wired/wifi) network_name=$(iw dev $connection_type link | awk -F': ' '/^\s*SSID:/ {print $2}') signal_strength=$(iw dev $connection_type link | awk '/signal:/ {print $2}') if [ -n $signal_strength ]; then case "$signal_strength" in -50) bars=4;; -60) bars=3;; -70) bars=2;; -80) bars=1;; *) bars=0;; esac echo -n "$bars"+"$network_name" else echo -n "disconnected" fi