Created
November 22, 2011 13:36
-
-
Save pimeys/1385674 to your computer and use it in GitHub Desktop.
Console wifi status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
iwconfig wlan0 2>&1 | grep -q no\ wireless\ extensions\. && { | |
echo wired | |
exit 0 | |
} | |
essid=`iwconfig wlan0 | awk -F '"' '/ESSID/ {print $2}'` | |
stngth=`iwconfig wlan0 | awk -F '=' '/Quality/ {print $2}' | cut -d '/' -f 1` | |
bars=`expr $stngth / 10` | |
case $bars in | |
0) bar='[----------]' ;; | |
1) bar='[/---------]' ;; | |
2) bar='[//--------]' ;; | |
3) bar='[///-------]' ;; | |
4) bar='[////------]' ;; | |
5) bar='[/////-----]' ;; | |
6) bar='[//////----]' ;; | |
7) bar='[///////---]' ;; | |
8) bar='[////////--]' ;; | |
9) bar='[/////////-]' ;; | |
10) bar='[//////////]' ;; | |
*) bar='[----!!----]' ;; | |
esac | |
echo $essid $bar | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment