Weird oddly specific character/symbol substitution going on. Bash's "read" interprets "?" as ";"
by the dsc from LinuxQuestions.org on (#6DDKP)
If this situation has any glaringly obvious solution somehow (other than reinstall the OS after formatting and/or exorcising the PC), I'd love to hear. But since it's not really critical at all (I've found a puzzling, ridiculous workaround), please don't even waste your time trying to imagine what could be going on, there are people with more need of help.
Code:while true ; do read -sn1 key ; echo key $key ; doneThat reproduces it consistently. Outside scripts using "read" in a similar fashion, the keys behave normally. The closest other weird thing is "xdotool key ?", which responds with "(symbol) No such key name ';'. Ignoring it." (twice, for some reason). If the question mark is between quotes, then xdotool shows it correctly in the same error message. The command "xdotool type ?" also correctly "types" a semicolon, with no error message, and correctly a question mark, if it's between quotes.
For added irony, I can insert somewhere on this loop: "xmodmap -pke | grep 97" and it will show what would seem to suggest everything is fine:
keycode 97 = slash question slash question degree questiondown degree
Possibly related things that I tried to eliminate to the extent I can imagine how to:
1. I had added two XCompose rules, one that would show "~/" immediately after typing the dead-key tilde followed by slash (the default behavior would be to require a space after the dead-key tilde), and another one would show tilde followed by one space for dead-tilde followed by space.
These rules didn't seem to have any other "wrong" effect I noticed. And removing my custom .XCompose file didn't fix the bash script "read" situation.
2. The other suspect things I've done "differently" were installing i3 and sway to maybe try out, besides KDE/plasma for wayland (while I'm normally/only using Openbox on X). I've uninstalled/purged most of those as I could, I guess, but it didn't fix the bash "read" issue. And whether that's related or not is just a tremendous wild guess, from having just tried out these things very recently. And I could include also have once logged on Fluxbox, but that's even less likely to have caused anything weird, I guess.
I think I can fix it for script purposes with the "hack" of adding
Code:xmodmap -e "keycode 97 = slash degree slash question degree questiondown degree"which attributes the degree symbol to the question mark keypress, and somehow works within that read loop, correcly printing i instead of question mark, while I was actually expecting for it to still give it the semicolon, for consistence sake. I would also find somewhat natural that the converse xmodmap command restoring question in place of degree, would "magically" fix this weird mess, but somehow "read" will still understand it as semicolon.
I guess my computer is possessed by a ghost of an internet troll with the most peculiar sense of humor.
Code:while true ; do read -sn1 key ; echo key $key ; doneThat reproduces it consistently. Outside scripts using "read" in a similar fashion, the keys behave normally. The closest other weird thing is "xdotool key ?", which responds with "(symbol) No such key name ';'. Ignoring it." (twice, for some reason). If the question mark is between quotes, then xdotool shows it correctly in the same error message. The command "xdotool type ?" also correctly "types" a semicolon, with no error message, and correctly a question mark, if it's between quotes.
For added irony, I can insert somewhere on this loop: "xmodmap -pke | grep 97" and it will show what would seem to suggest everything is fine:
keycode 97 = slash question slash question degree questiondown degree
Possibly related things that I tried to eliminate to the extent I can imagine how to:
1. I had added two XCompose rules, one that would show "~/" immediately after typing the dead-key tilde followed by slash (the default behavior would be to require a space after the dead-key tilde), and another one would show tilde followed by one space for dead-tilde followed by space.
These rules didn't seem to have any other "wrong" effect I noticed. And removing my custom .XCompose file didn't fix the bash script "read" situation.
2. The other suspect things I've done "differently" were installing i3 and sway to maybe try out, besides KDE/plasma for wayland (while I'm normally/only using Openbox on X). I've uninstalled/purged most of those as I could, I guess, but it didn't fix the bash "read" issue. And whether that's related or not is just a tremendous wild guess, from having just tried out these things very recently. And I could include also have once logged on Fluxbox, but that's even less likely to have caused anything weird, I guess.
I think I can fix it for script purposes with the "hack" of adding
Code:xmodmap -e "keycode 97 = slash degree slash question degree questiondown degree"which attributes the degree symbol to the question mark keypress, and somehow works within that read loop, correcly printing i instead of question mark, while I was actually expecting for it to still give it the semicolon, for consistence sake. I would also find somewhat natural that the converse xmodmap command restoring question in place of degree, would "magically" fix this weird mess, but somehow "read" will still understand it as semicolon.
I guess my computer is possessed by a ghost of an internet troll with the most peculiar sense of humor.