Improve wireless detection when interface is down

This commit is contained in:
Moisés Carvalho 2020-05-27 15:24:30 -03:00
parent efe6ff2220
commit 131bcdae10

View file

@ -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