diff options
author | Tucker Evans <tucker@tuckerevans.com> | 2020-09-17 13:34:05 -0400 |
---|---|---|
committer | Tucker Evans <tucker@tuckerevans.com> | 2020-09-17 13:34:05 -0400 |
commit | 1cdf585d43ef44f721daaee44b7a5f266775289f (patch) | |
tree | 392abf0aab5e60fd6b2c6184468707a1748e06c9 /lemonbar/bin/get_network_info.sh | |
parent | 2d2f468edac08da94fc8a532f91f2dfa6d89d158 (diff) |
Update lemonbar scripts
Diffstat (limited to 'lemonbar/bin/get_network_info.sh')
-rwxr-xr-x | lemonbar/bin/get_network_info.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lemonbar/bin/get_network_info.sh b/lemonbar/bin/get_network_info.sh new file mode 100755 index 0000000..f85b0f6 --- /dev/null +++ b/lemonbar/bin/get_network_info.sh @@ -0,0 +1,25 @@ +#!/bin/sh + + +for DEV in `ip -o addr | awk '{if($2 != "lo" && $3 == "inet"){print $2}}'` +do + SSID="" + OUTPUT="" + ADDR=`ip addr show dev "$DEV" | grep -E "inet[^6]" \ + | awk '{print $2}'` + MATCH=`expr "$DEV" : "^wlp"` + if test "$MATCH" -gt 0 + then + SSID=`iw dev "$DEV" link | grep SSID | awk '{print $2}'` + SSID="$SSID: " + fi + + if test -n "$OUTPUT" + then + OUTPUT="$OUTPUT | ($DEV) $SSID$ADDR" + else + OUTPUT="($DEV) $SSID$ADDR" + fi +done + +echo "$OUTPUT" |