[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: delete key doesn't work with csh in xterm session

Please don't "thread steal".  You replied to a message with subject
"Kernel Compile (being really stupid)" and then changed the subject.
What does this have to do that that?

Lucas Albers wrote:
> I recently upgraded our central server from redhat 7.3 to debian woody/sarge.
> Not so hard, been really happy with the new setup.

Glad to hear it.  Just noting that none of the discussion I provide
here should be any different between Red Hat and Debian.  Both are
using the Linux kernel and this is all related to the kernel.

> For users using /bin/csh and running rxvt-xterm, their delete key does not
> work.
> Users running /bin/bash and running rxvt-xterm, their delete key does work.
> Both delete keys work on an ssh session.

When you say it does not work do you mean it prints out ^H or ^? or
something like that?  If yes then which one is it?  Here is what you
need to know if that is the problem.

Keyboards connected to linux kernels produce DEL (delete) which is
character ^? aka 0x7F.  Keyboards connected to some other kernels such
as HP-UX produce BS (backspace) which is character ^H aka 0x08.
Terminal emulators such as putty will also pick one or the other.  I
could cite other data points but you did not say what you were using
so just assume that it might be one way or it might be the other way
and you need to figure out which way your way is.

Do not confuse the keypad-delete found on PC keyboards to the right
side with normal delete.  That is an additional key and not related to
normal delete.  Most people like the keypad delete to delete the
character in front of the point and not behind the point like normal
delete.  The keypad delete scancode produced by the keyboard is
usually mapped into an escape sequence (ESC [ 3 ~ on ANSI standard
terminals) and not a single character.

Since different hosts have different erase character settings the
tty driver can be configured with different erase settings.

  stty erase ^H


  stty erase ^?

The system will usually default to one or the other.  Linux kernels
default to ^?.  Stallman is a long time vocal advocate that ^? is the
one true way and ^H is Wrong and wrote the popular emacs editor such
that using it on other systems takes special handling.  This has
certainly been one reason ^? is more popular today.

Some very old time systems were connected to very old terminals
without any backspace key.  Think typewriters converted to computer
use.  You can't get the ink off of the paper after being printed.  A
common backspace key there was the # key.  So some very old unix
systems default to the tty driver assuming that # is the erase
character.  (I think HP-UX still does this but /etc/profile overrides
it now.)  Others assumed @ was the erase character like the Honeywell
that I used way back when but that was an unusual machine even then.

So the first step is to determine what character is produced when you
use the "<-- backspace" key on your keyboard.  Is it ^H (BS) or ^?
(DEL) and you will need to set your tty erase character appropriately
with the stty command.  This is frequently troublesome when logging in
from one computer to another across the network.  The other computer
will assume its own setting and you will need to update it to yours.
It would be oh so nice if all computers used the same key.  It would
be oh so nice if all of the world drove on the same side of the road.
But it ain't so.

Another important point.  The bash shell accepts pretty much anything
for backspace.  ^H, ^? or the current stty erase setting.  I am sure
they got tired of hearing about the problem.  But other shells, other
editors, vi, emacs, less, more, etc. all do the right thing and use
the configured erase character from the tty driver.  You can see the
current erase setting in the 'stty -a' output.  This is what makes
bash appear to work but other shells not.  It is not really working.
It is just hiding the problem.  If you start up less on a file you
will find that backspace does not work there even when it is working
on bash.  So you should configure it properly regardless of your

> I've looke through google, and found some items on setting delete keys
> manually but they do not appear to be applying correctly for csh.

Very little applies correctly to csh.  The csh was the ultimate shell
to use on paper terminals.  But now that most people using computers
today is, "you are using a what?" it is better to forget about it
entirely.  I highly recommend you use a more modern shell.  I am not
talking about tcsh either.  :@}

> I've run accross references to two methods for setting the delete key:
> bindkey "e[^H" delete-char        # Delete
> and
> stty echoe erase ^H

The stty command can take a long string of args.  The 'echoe' means
convert the erase character into a backspace-space-backspace
sequence.  This is otherwise known as crterase.  The fact that it is
named "CRT" erase to differentiate it should be telling the type of
computers which used one versus the other in the old days.  Using
echoe is a good thing but likely the default and I really doubt you
need to set it.  Check 'stty -a' for the current settings.

> But neither work for csh rxvt-xterm sessions.
> Any ideas on what else I can try?
> -- 
> --Luke CS Sysadmin, Montana State University-Bozeman

Because you are at a university I was assuming that you were mixing
and matching different types of machines.  A possibly incorrect
assumtion, however.

Hope that helped.


Attachment: pgp2U4yWh4fFB.pgp
Description: PGP signature

Reply to: