Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an old RedHat box that I have to get some work done on:

$ lsb_release -a
LSB Version:    1.3
Distributor ID: RedHatEnterpriseWS
Description:    Red Hat Enterprise Linux WS release 4 (Nahant Update 7)
Release:        4
Codename:       NahantUpdate7

I am having serious trouble with the shell prompt. (bash) In particular, if I type the following on the command line:

$ abcdefghijklmnopqrstuvwxyz

... then if I arrow back to the m character, for example, and press Delete, I get this:

$ abcdefghijkLMNopqrstuvwxyz

(But it gets worse. If I then arrow around more, it only flips one letter at a time.)

I compared my stty settings with an Ubuntu machine where it works fine, and I don't see a significant difference. They are as follows:

$ stty -a
speed 38400 baud; rows 58; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -ixon -ixoff
-iuclc -ixany -imaxbel
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke

This is driving me crazy. Is there anything else I should look up? What could possibly be causing this?

share|improve this question
up vote 2 down vote accepted

It makes perfect sense now...

There was a stray line in the .profile my company uses, since a lot of people are still using ksh:

set -o vi

Well, guess what happens in vi if you type ~? That's right, it swaps the case! And guess what happens if you type 3~? It swaps the case of 3 characters! (Though I'm still not sure now to explain the inconsistent behavior where sometimes it swaps one and sometimes it swaps 3...)

In any case, removing the set -o vi from my .profile solved the problem.

share|improve this answer
    
I'd say "Ouch" if the commenting system would let me. – innaM Oct 30 '09 at 16:22

Is there a .inputrc file in your home directory? If not, try creating one with this content:

"\e[3~": delete-char

If there is such a file, maybe it does something it should not do?

share|improve this answer
    
Thanks for the response. I don't have an ~/.inputrc. I added one with the text you suggested and it changes the behavior; now the prompt changes to (for example) "(arg: 3) abcefg" when I type "abcdefg" and arrow back to "d" and press delete. However, after that it reverts to the old case-swapping behavior. – Mike Oct 30 '09 at 16:03
    
The "(arg:" thing appears before you hit DEL? – innaM Oct 30 '09 at 16:12
    
It looks like the "(arg: N)" prompt is what appears in vi mode when you type some combination of "<esc>#", though I have not used that functionality, so I'm not sure what exactly it's done. By the way, thanks for decomposing the delete key into its escape sequence; that helped me solve the problem. – Mike Oct 30 '09 at 16:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .