当前位置: 动力学知识库 > 问答 > 编程问答 >

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

问题描述:

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.

网友答案:

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.

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: