![通过shell脚本在OS X中查找WiFi网络名称(SSID)](https://linux22.com/image/1275178/%E9%80%9A%E8%BF%87shell%E8%84%9A%E6%9C%AC%E5%9C%A8OS%20X%E4%B8%AD%E6%9F%A5%E6%89%BEWiFi%E7%BD%91%E7%BB%9C%E5%90%8D%E7%A7%B0%EF%BC%88SSID%EF%BC%89.png)
如何通过 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