Merge pull request #31 from ImperadorSid/network-linux

Improve wireless detection when interface is down
This commit is contained in:
Dane Williams 2020-05-27 14:17:40 -07:00 committed by GitHub
commit 9e2851a6e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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
printf '%s' "$SSID"
else
echo 'Ethernet'
fi