Get WiFi SSID in Terminal on Mac OS X

Get WiFi SSID in Terminal on Mac OS X

#https://superuser.com/a/281259
network_SSID="$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | sed -e "s/^ *SSID: //p" -e d)"

Anyone know what sed -e "s/^ *SSID: //p" -e d does?
-e expression or script
s/ does substitution
^ start of line
space
* 0 or more spaces
SSID: the literal SSID:[space]
// means replace with empty string
p Print out the pattern space (to the standard output). (Not quite sure what this means)
-e d I think this means delete what is not matched (So only show what was matched)

Leave a Reply

Your email address will not be published. Required fields are marked *