cannot type 'e' or 'P' in MinGW/msys shells or terminals
Asked Answered
D

2

7

I have successfully installed and used MinGW and msys in the past to compile and link Windows executables. On a fresh installation for 32-bit Vista (the same platform as when I had previous success) I am getting some maddening behavior: when I type lower-case 'e' or upper-case 'P' in the provided shell environments I get an audible beep but no character! Meaning I cannot type "make" or "echo" and then run those commands, for instance. It goes: m-a-k-BEEP!

This no 'e' BEEPing occurs in the shell that opens when you invoke msys via the shortcut that gets generated by the installer, and in shells by navigating to c:\msys\1.0\bin and just double-clicking bash.exe, sh.exe, rxvt.exe (actually that has more of a muffled noise puff than a crisp BEEP), but always lower-case 'e' and capital 'P' will not echo to the terminal (or shell? obviously I don't have a handle on the differences between these terms).

I have tried the automated MinGW and msys installers, and a fresh manual install to the same end.

I do not understand shells very well, or how their environments evolve as they start up, so I don't know where to start looking for the source of this wacky behavior.

Darrondarrow answered 5/2, 2011 at 7:2 Comment(1)
Got the same issue with git shell on Windows, not with fresh MinGW's bash though. (The same fix worked)... Maybe that's specific for some MSys version?Mischief
D
12

I'm assuming you're using Bash. It sounds to me like the key bindings have gotten messed up for some reason.

If you do this command:

bind -p|grep -i '"[pE]"'

you should get this result:

"E": self-insert
"e": self-insert
"P": self-insert
"p": self-insert

If the entries for "P" and "e" are missing then try these commands.

bind '"e":self-insert'
bind '"P":self-insert'

Obviously, you can't type the characters, so type their opposite-case version, press left-arrow, then press Alt-u to upcase the small "p" or Alt-l (that's a lower-case "ell") to downcase the capital "E" (you will need to do this for each "e" in the first command).

If that works, check the ~/.inputrc file for invalid keybindings. Also, check your startup files such as ~/.bashrc, etc. The issue is likely to be with missing or misplaced quotation marks and it may be for a key binding for something like \eP which, by default, is bound to the readline function do-lowercase-version.

Dragrope answered 5/2, 2011 at 8:15 Comment(5)
Your instructions worked perfectly. I was able to see that indeed "P" and "e" did not have self-insert bindings, added them in, everything worked. Then I started hunting around and sure enough in my '~/.inputrc' file I found the offending lines I had added, thinking them benign: 'echo $PATH' and 'PATH = $PATH:/c/MinGW/msys/1.0/bin:.' and 'echo $PATH' which for whatever reason when in cause the problem, and when taken out fix it. Thank you!Darrondarrow
@dim fish: Yes, ~/.inputrc isn't an executable file so you can't put commands in it.Dragrope
@DennisWilliamson I have the same problem with "b". I had the same problem with "e" which I solved by removing all settings from .inputrc. Before "b" inserted a single double-quote, now pressing "b" inserts an infinite string of double-quotes until i press ctrl-c. I put bind '"b":self-insert' into inputrc but no changes.My msys is very minimal, almost no packages except for coreutils.Adze
@otonvm: bind is a shell command, so you might use it in a shell script (such as ~/.bashrc). However, to add key bindings in ~/.inputrc omit the bind command and the outer set of single quotes. Also note that a dot is the first character of the name .inputrcDragrope
@DennisWilliamson Ah I see now! I just assumed that .inputrc is the same as .profile or .bash_profile. It's obvious now. Thanks! (I should have read the comment before better, sorry!)Adze
B
0

In the directory C:\Documents and Settings\yourusername, you can find a file named '.bashrc' add the following 2 lines bind '"e":self-insert' bind '"P":self-insert'

Dennis Williamson, Thank you very much! This problem bothering me for a long time.

Bevus answered 2/6, 2011 at 9:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.