use awk instead

This commit is contained in:
Léana 江 2022-12-24 04:20:47 +01:00
parent 99a6fc0770
commit c2bac01778

View file

@ -3292,7 +3292,7 @@ get_network() {
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")"
LinkSpeed="$(ifconfig $ActiveNetwork | awk '/media/{ print }' | gsed -E "s/.*\((.*)\).*/\1/gm")"
fi
network="$ActiveNetwork: $ActiveNetworkName@$LinkSpeed"
;;