Merge pull request #3 from ginglis13/linux-network

network: add support for linux
This commit is contained in:
Dane Williams 2020-04-07 22:26:09 -07:00 committed by GitHub
commit 553d34499b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,11 +7,32 @@
get_ssid() 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)
else
echo ' Ethernet'
fi
;;
Darwin)
if /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | grep -E ' SSID' | cut -d ':' -f 2 &> /dev/null; then if /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | grep -E ' SSID' | cut -d ':' -f 2 &> /dev/null; then
echo "$(/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | grep -E ' SSID' | cut -d ':' -f 2)" echo "$(/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | grep -E ' SSID' | cut -d ':' -f 2)"
else else
echo ' Ethernet' echo ' Ethernet'
fi fi
;;
CYGWIN*|MINGW32*|MSYS*|MINGW*)
# leaving empty - TODO - windows compatability
;;
*)
;;
esac
} }
main() main()