diff --git a/dnscrypt-proxy-switcher.10s.sh b/dnscrypt-proxy-switcher.10s.sh index 73ba2ac..8f70931 100755 --- a/dnscrypt-proxy-switcher.10s.sh +++ b/dnscrypt-proxy-switcher.10s.sh @@ -54,17 +54,22 @@ ospatch=$(echo "$osversion" | awk -F. '{print $3}') get_current_service() { services=$(networksetup -listnetworkserviceorder | grep -F 'Hardware Port') - echo "$services" | while read -r line; do + while read -r line; do sname=$(echo "$line" | awk -F "(, )|(: )|[)]" '{print $2}') sdev=$(echo "$line" | awk -F "(, )|(: )|[)]" '{print $4}') if [ -n "$sdev" ]; then ifout="$(ifconfig "$sdev" 2>/dev/null)" if echo "$ifout" | grep -Fq 'status: active'; then - currentservice="$sname" - break + if [ "$sname" == 'USB 10/100/1000 LAN' ]; then + currentservice="${sname} ($sdev)" + break + else + currentservice="$sname" + break + fi fi fi - done + done <<<"${services}" if [ -n "$currentservice" ]; then echo "$currentservice"