From 131bcdae108e804aba89092faaa2e3fb7938aa88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mois=C3=A9s=20Carvalho?= Date: Wed, 27 May 2020 15:24:30 -0300 Subject: [PATCH] Improve wireless detection when interface is down --- scripts/network.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/network.sh b/scripts/network.sh index 045445c..fdfda04 100755 --- a/scripts/network.sh +++ b/scripts/network.sh @@ -7,8 +7,9 @@ get_ssid() # Check OS case $(uname -s) in Linux) - if iw dev | grep ssid | cut -d ' ' -f 2 &> /dev/null; then - echo "$(iw dev | grep ssid | cut -d ' ' -f 2)" + SSID=$(iw dev | sed -nr 's/^\t\tssid (.*)/\1/p') + if [ -n "$SSID" ]; then + echo -- "$SSID" else echo 'Ethernet' fi