如何通过 shell 脚本在 Snow Leopard 上找到我连接的 WiFi 网络名称?
答案1
network_SSID="$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | sed -e "s/^ *SSID: //p" -e d)"
答案2
#!/bin/bash
SSID=$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk -F': ' '/ SSID/ {print $2}')
echo $SSID