0

So I found something somewhat interesting in ksh. I found that if the last character is \, then immediately backspace, the charcter becomes recplaced with ^H. I am then able to press backspace again to clear it away.

What kind of wizardry am I dealing with here? Is this a bug? Trying this in bash did not yield the same result.

Chad Harrison
  • 6,990
  • 10
  • 29
  • 41
  • The OS is AIX 5.3. Not sure what version of ksh (looking now), but what I mean is that the very last symbol is literally `\ `. I forgot the context in which I found myself backspacing `\ `, but I tried it again later and found the same thing.. – Chad Harrison Aug 16 '12 at 19:32
  • I reproduced it in ksh93 on Linux, and all I needed was `set -o vi` – Alan Curry Aug 16 '12 at 21:55

1 Answers1

1

It's intentional, although I won't disagree about it being weird. When vi or emacs mode is enabled (set -o vi or set -o emacs) ksh provides this feature (which is present in neither vi nor emacs as far as I know) where the backslash quotes a following control character.

It's like the lnext character (Ctrl-V) but weaker. You can enter a literal backspace this way, but to enter a literal ^C you need the ^V first.

Alan Curry
  • 346
  • 2
  • 4