Modify how network name is parsed for Mac because airport command is deprecated in 14.4+

This commit is contained in:
Pratyush Nalam 2024-04-08 14:20:55 +05:30 committed by GitHub
parent 787e9cded3
commit df75ea2a46
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,8 +18,8 @@ get_ssid()
;;
Darwin)
if /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | grep -E ' SSID' | cut -d ':' -f 2 | sed 's/^[[:blank:]]*//g' &> /dev/null; then
echo "$(/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | grep -E ' SSID' | cut -d ':' -f 2)" | sed 's/^[[:blank:]]*//g'
if networksetup -getairportnetwork en0 | cut -d ':' -f 2 | sed 's/^[[:blank:]]*//g' &> /dev/null; then
echo "$(networksetup -getairportnetwork en0 | cut -d ':' -f 2)" | sed 's/^[[:blank:]]*//g'
else
echo 'Ethernet'
fi