fixed network module for macOS
This commit is contained in:
@@ -3286,6 +3286,16 @@ get_network() {
|
|||||||
fi
|
fi
|
||||||
done < <(find /sys/class/net/ -type l)
|
done < <(find /sys/class/net/ -type l)
|
||||||
;;
|
;;
|
||||||
|
"Mac OS X"|"macOS")
|
||||||
|
ActiveNetwork=$(route get default | grep interface | awk '{print $2}')
|
||||||
|
ActiveNetworkName=$(networksetup -listallhardwareports | grep -B 1 "$ActiveNetwork" | awk '/Hardware Port/{ print }'|cut -d " " -f3-)
|
||||||
|
if [[ $ActiveNetworkName == "Wi-Fi" ]]; then
|
||||||
|
LinkSpeed="$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/maxRate/{ print }' | xargs | cut -d " " -f2)Mbps"
|
||||||
|
else
|
||||||
|
LinkSpeed="$(ifconfig $ActiveNetwork | grep 'media:' | gsed -E "s/.*\((.*)\).*/\1/gm")"
|
||||||
|
fi
|
||||||
|
network="$ActiveNetwork: $ActiveNetworkName@$LinkSpeed"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
while IFS=' ' read -r n i; do
|
while IFS=' ' read -r n i; do
|
||||||
if [ -n "$i" ]; then
|
if [ -n "$i" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user