After a little modification your solution seams to work, type must also be included:
conn=$(nmcli -t -f UUID,TYPE,NAME con list | grep wireless | grep -e "$ap$" | awk -F\: '{print $1}')
I'll see if the result shows up on friendly.ubuntu.com soon.
I think this would be a good fix as it's not too uncommon that your company wireless and VPN have similar names.
After a little modification your solution seams to work, type must also be included:
conn=$(nmcli -t -f UUID,TYPE,NAME con list | grep wireless | grep -e "$ap$" | awk -F\: '{print $1}')
I'll see if the result shows up on friendly.ubuntu.com soon.
I think this would be a good fix as it's not too uncommon that your company wireless and VPN have similar names.