Uladzislau Shablinski
Uladzislau Shablinski

Reputation: 174

Can't type 'a' symbol in terminal

I got into a strange behaviour of my terminal. Both iTerm and basic terminal on my OS X don't work. I can only type 'A' instead of 'a', but not the 'a' letter. If I try bash --noediting then I can type 'a' but it's very uncomfortable to use. I checked my ~/.bashrc, ~/.bash_profile and did't find anything that seemed strange for me. Could anyone help me? Any feedback appreciated.

Upvotes: 3

Views: 2232

Answers (2)

rici
rici

Reputation: 241901

Most likely you've somehow introduced a readline binding for a.

As a first step, try this: (The grep argument is $"a", but you can't type that :) )

bind -p | grep $'"\x61"'

It should print this:

"a": self-insert

If it does, then my guess is wrong, and you'll need to look elsewhere. If it doesn't, then you need to fix it, which you can do like this:

bind $'"\x61"':self-insert

Now you need to find where in your bash start-up files the incorrect bind command is. I'd start by grepping for bind. It may well be in a file sourced from one of those files. Good luck.

You should also check the file ~/.inputrc which is used by the readline library to initialize it's bindings.

Upvotes: 7

Jonathan Leffler
Jonathan Leffler

Reputation: 754910

If the letter a has been mapped to one of the control characters, you can get some funny effects. Try stty -a, except that you'll probably need to type:

  • s, t, t, y, , -, Control-V, a

to get the -a to the command. This should show you something like:

speed 9600 baud; 65 rows; 135 columns;
lflags: icanon isig iexten echo echoe -echok echoke -echonl echoctl
    -echoprt -altwerase -noflsh -tostop -flusho pendin -nokerninfo
    -extproc
iflags: -istrip icrnl -inlcr -igncr ixon -ixoff ixany imaxbel iutf8
    -ignbrk brkint -inpck -ignpar -parmrk
oflags: opost onlcr -oxtabs -onocr -onlret
cflags: cread cs8 -parenb -parodd hupcl -clocal -cstopb -crtscts -dsrflow
    -dtrflow -mdmbuf
cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = <undef>;
    eol2 = <undef>; erase = ^?; intr = ^C; kill = ^X; lnext = ^V;
    min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
    stop = ^S; susp = ^Z; time = 0; werase = ^W;

except that if my suspicion is correct, one of the cchars values is a.

Upvotes: 1

Related Questions