Mailing List Archive


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

Re: [tlug] Bash 4.1 question



On 2011-09-28 at 13:51:09, Stephen J. Turnbull wrote:
>Daniel A. Ramaley writes:
> > to add control-backspace to that list. Unfortunately, it seems bash
> > thinks backspace is really control-h so it is difficult to map an
> > extra control onto that.
>
>Maybe it *really* is control-h.  Try fixing your terminal?

That got me to research some more. I found that by typing ctrl-v and 
then some other key, Bash will tell me what it thinks that other key is.

When running under gnome-terminal (my terminal of choice) i get these:
	backspace: ^?
	ctrl-backspace: ^?
	delete: ^[[3~
	ctrl-delete: ^[[3;5~

So, it seems the control key does change the keystroke for the delete 
key, but it doesn't do anything for backspace.

I tried running an xterm and i get something different for ctrl-
backspace:
	backspace: ^?
	ctrl-backspace: ^H
	delete: ^[[3~
	ctrl-delete: ^[[3;5~

Note that both gnome-terminal and xterm report their TERM variable as 
"xterm", so they *should* be the same to the shell... i can see some 
differences in "stty -a" output though that tells me reality is slightly 
more complicated than that, however.

Anyway, when running under xterm, it should be possible to get the 
behavior i want, since Bash can distinguish between the keystrokes. But 
what about gnome-terminal? I guess i do need to fix the terminal. In 
gnome-terminal's "Compatibility" settings i can choose from these 
options to send for the backspace and delete keys: Automatic, Control-H, 
ASCII DEL, Escape sequence, TTY Erase. "ASCII DEL" is the default for 
the backspace key. I've tried all of the others, though. And they all 
suffer from the same problem: the terminal sends the same thing for 
backspace and ctrl-backspace. By choosing different options for what it 
sends for backspace, i can get it to change what it sends. But backspace 
and ctrl-backspace are always the same, regardless of what they happen 
to be. Since Bash always sees the same character, i think the only 
solution would be to change terminals, or get the bug in gnome-terminal 
fixed.

Now having a deeper understanding of the issue, i was even able to find 
a (fairly old) bug report on it, and a patch to fix it:
	https://bugzilla.gnome.org/show_bug.cgi?id=420039

So i guess now i have to decide whether this problem annoys me enough to 
patch gnome-terminal and maintain my custom version of it, or if i 
should just live with it.

Thanks for the nudge in the right direction.

__
Daniel A. Ramaley
Network Engineer 2

Dial Center 112, Drake University
2407 Carpenter Ave / Des Moines IA 50311 USA
Tel: +1 515 271-4540
Fax: +1 515 271-1938
E-mail: daniel.ramaley@example.com



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links