Wireless connecting via CLI/Terminal

Do you use the CLI a lot and encounter new Wi-Fi sources, but don't want to/can't remember the commands to connect to the Internet?? I'm lazy. I mean, that's what scripting is for, right?? Efficiency means obtaining the maximum result with maximum laziness. I wrote this small script a while ago and have improved on it several times over the course of about 6 months. I personally like it a lot (obviously, I wrote it) and thought that others might also. So here it is. Also, any comments, ideas, changes, don't hesitate to post!! New ideas and ways of making things work better is always appreciated by everyone.

#!/bin/bash

 # Wi-Fi Commander, a lazy way to lazily connect to the WiFi

 # Updated: 15-8-16, Version 3.5

 # This script requires that nmcli, w3m, and w3m-img (if
 # you want to be able to see pictures), are all installed
 # on the computer running it

 # You must be a sudoer or root to use this script


DDG="www.duckduckgo.com"


test () {
echo; nmcli c show --active
echo; ping -q -c 3 $DDG
if [ "$?" -eq "0" ];
then echo; echo "Connection Successful."
else echo; echo "Connection Unsuccessful."
fi
}

discon () {
nmcli d disconnect wlan0
if [ "$?" -eq "10" ];
then echo; echo "wlan0 not found." ; echo; sleep .75; discon2
fi
}

discon2 () {
echo $(sudo ifconfig -a -s); echo; echo "Deactivate which connection??"; read dcon; nmcli d disconnect "$dcon"; echo
if [ "$?" -eq "10" ];
then echo; echo "Error with the Wi-Fi Adapter."
fi
}

interweb () {
echo; w3m $DDG
if [ "$?" -eq "0" ];
then echo " ";
else echo; echo "You are not connected to the internet."
fi
}


echo; echo "Welcome to Wi-Fi Commander."; sleep .75; echo

PS3="Wi-Fi Command: "
echo "Command Menu:"; echo; select command in "Activate Wireless device" "Scan for Wi-Fi" "Connect to new Wi-Fi" "Connect to a Saved Connection" "Test Connection" "Disconnect from Wi-Fi" "View Saved Connections" "View a Saved Connection's password" "Deactivate Wireless device" "Delete a Saved Connection" "Launch Browser (W3M)" "Exit"
do
case $command in
"Activate Wireless device") echo $(sudo ifconfig -a -s); echo; echo "Activate which device??"; echo; read device; sudo ifconfig "$device" up; echo;;
"Scan for Wi-Fi") echo; echo $(sudo iwlist scanning | grep -E "Quality|Signal level|Encryption key|ESSID"); echo;;
"Connect to new Wi-Fi") echo; echo "SSID:"; echo; read ssid; echo; echo "Key:"; echo; read -s passwd; sudo nmcli d wifi connect "$ssid" password "$passwd"; echo;;
"Connect to a Saved Connection") echo $(nmcli c); echo; echo "Connect to??"; echo; read ssid; nmcli c up id "$ssid";;
"Test Connection") test;;
"Disconnect from Wi-Fi") discon;;
"View Saved Connections") echo; echo $(nmcli c); echo;;
"View a Saved Connection's password") echo; echo $(nmcli c); echo; echo "Which Saved Connection??"; echo; read ssid; echo; sudo -k echo&&echo $(nmcli --show-secrets connection show "$ssid" | grep -E "802-11-wireless-security.psk:");;
"Deactivate Wireless device") echo $(sudo ifconfig -a -s); echo; echo "Deactivate which device??"; echo; read device; sudo ifconfig "$device" down; echo;;
"Delete a Saved Connection") echo; echo $(nmcli c); echo; echo "Delete which??"; echo; read ssid; nmcli c delete id "$ssid";;
"Launch Browser (W3M)") interweb;;
"Exit") echo; echo "Goodbye."; echo; exit;;
*) echo; echo "Command not recognised.";;
esac
echo; echo "Press Enter to view the Command Menu again."; echo
done