Command to print name of SSID to which I am connected
How about iwgetid
? The iwgetid(8) man page says:
iwgetid is used to find out the NWID, ESSID or AP/Cell Address of the wireless network that is currently used.
This may work:
/sbin/iwconfig wlan0 | grep ESSID