Hi CentralWare
I set the ESSID on my router to:
I'm a rule breaker & ! ?\$ * = \
And my modified wifi.sh was able to connect:
Select Wifi Network
ESSID Enc Qual Channel Type
1. I'm a rule breaker & ! ?\$ * = \ on 47 11 WPA
2. ROMY_WIFI on 22 9 WPA
3. Verizon_Z6DL3H on 19 6 WPA
Enter selection ( 1 - 3 ) or (q)uit: 1
Enter password for I'm a rule breaker & ! ?\$ * = \ (8 to 63 characters): PASSWORD
Sending credentials to requested access point I'm a rule breaker & ! ?\$ * = \# reading passphrase from stdin
..
deleting routers
adding dns 192.168.1.1
tc@box:~$
The formatted ESSID wifi.sh placed in wifi.db looks like this:
I\'m\ a\ rule\ breaker\ \&\ \!\ \?\\\$\ \*\ \=\ \\ PASSWORD WPA
Try as I might, I couldn't get wifi.sh to accept a percent sign.
It responded with Invalid format specifier. Probably a printf
command complaining.
The changes involved adding a bunch of gsub() statements.
Some extra surrounding lines are shown for context.
From this:
gsub(" ","\\ ",sid[i])
To this:
if ( mode == "auto" ) {
print("Attempting auto connection with " autoconnect)
for (i in sid) {
gsub("\134\134","\134\134",sid[i]) # Backslash (must come first)
gsub(" ","\\ ",sid[i]) # Space
gsub("\047","\\\047",sid[i]) # Single quote
gsub("&","\\\\&",sid[i]) # Ampersand
gsub("!","\\!",sid[i]) # Exclamation mark
gsub("?","\\?",sid[i]) # Question mark
gsub("\\$","\\$",sid[i]) # Dollar sign
gsub("\\*","\\*",sid[i]) # Asterisk
gsub("\\=","\\=",sid[i]) # Equal sign
if (autoconnect == sid[i] ) {
associate(type[i],wifi,sid[i],mypass,chan[i])
system( "udhcpc " lease "-i " wifi " -x hostname:" currenthostname " 2>/dev/null" )
exit
And this:
gsub(" ","\\ ",sid[selection])
To this:
if ( offset == 1 && selection != "q") {
sid_display = sid[selection]
password = ""
newitem=""
gsub("\134\134","\134\134",sid[selection]) # Backslash (must come first)
gsub(" ","\\ ",sid[selection]) # Space
gsub("\047","\\\047",sid[selection]) # Single quote
gsub("&","\\\\&",sid[selection]) # Ampersand
gsub("!","\\!",sid[selection]) # Exclamation mark
gsub("?","\\?",sid[selection]) # Question mark
gsub("\\$","\\$",sid[selection]) # Dollar sign
gsub("\\*","\\*",sid[selection]) # Asterisk
gsub("\\=","\\=",sid[selection]) # Equal sign
if ( enc[selection] == "on" ) {
while ( getline dbitem < dbfile > 0 ) {
split(dbitem,field,"\t")
CAUTION: This subsubsection has been reported to cause headaches.
You might want to skip it upon first reading.
Found here:
https://www.gnu.org/software/gawk/manual/html_node/Gory-Details.html