PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > backspace key binding
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

backspace key binding

Réponse
 
LinkBack Outils de la discussion
Vieux 17/07/2007, 21h53   #1
wenmang
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut backspace key binding

Hi, all,

In my profile, "erase" is set to "set erase '^h'" which is working for
most of times. But, sometime, I use xterm to create a new terminal and
the backspace key is set to "^?" instead for unknown some reasons, my
platform is Redhead Linux, not sure why it happens and how to prevent
it happening. thx.

  Réponse avec citation
Vieux 18/07/2007, 13h13   #2
Glenn Jackman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: backspace key binding

At 2007-07-17 04:53PM, "wenmang" wrote:
> Hi, all,
>
> In my profile, "erase" is set to "set erase '^h'" which is working for


Don't you want: stty erase ^H

--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry
  Réponse avec citation
Vieux 18/07/2007, 14h04   #3
Bill Marcum
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: backspace key binding

On Tue, 17 Jul 2007 13:53:18 -0700, wenmang
<wenmang@yahoo.com> wrote:
>
>
> Hi, all,
>
> In my profile, "erase" is set to "set erase '^h'" which is working for
> most of times. But, sometime, I use xterm to create a new terminal and
> the backspace key is set to "^?" instead for unknown some reasons, my
> platform is Redhead Linux, not sure why it happens and how to prevent
> it happening. thx.
>

case "$TERM" in
*xterm*) stty erase '^?' ;;
"") ;;
*) stty erase '^h' ;;
esac

--
Most people want either less corruption or more of a chance to
participate in it.
  Réponse avec citation
Vieux 18/07/2007, 14h04   #4
Bill Marcum
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: backspace key binding

On Tue, 17 Jul 2007 13:53:18 -0700, wenmang
<wenmang@yahoo.com> wrote:
>
>
> Hi, all,
>
> In my profile, "erase" is set to "set erase '^h'" which is working for
> most of times. But, sometime, I use xterm to create a new terminal and
> the backspace key is set to "^?" instead for unknown some reasons, my
> platform is Redhead Linux, not sure why it happens and how to prevent
> it happening. thx.
>

case "$TERM" in
*xterm*) stty erase '^?' ;;
"") ;;
*) stty erase '^h' ;;
esac

--
Most people want either less corruption or more of a chance to
participate in it.
  Réponse avec citation
Vieux 20/07/2007, 14h37   #5
wenmang
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: backspace key binding

On Jul 18, 9:04 am, Bill Marcum <marcumb...@bellsouth.net> wrote:
> On Tue, 17 Jul 2007 13:53:18 -0700, wenmang <wenm...@yahoo.com> wrote:
>
> > Hi, all,

>
> > In my profile, "erase" is set to "set erase '^h'" which is working for
> > most of times. But, sometime, I use xterm to create a new terminal and
> > the backspace key is set to "^?" instead for unknown some reasons, my
> > platform is Redhead Linux, not sure why it happens and how to prevent
> > it happening. thx.

>
> case "$TERM" in
> *xterm*) stty erase '^?' ;;
> "") ;;
> *) stty erase '^h' ;;
> esac
>
> --
> Most people want either less corruption or more of a chance to
> participate in it.


All my terminals are xterms, but sometime the backspace binding is
changed during launching the new xterm. Do we have the way to preset
the backspace key to prevent it changing in a script?

  Réponse avec citation
Vieux 20/07/2007, 23h42   #6
Bryan Harris
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: backspace key binding

On Jul 20, 8:37 am, wenmang <wenm...@yahoo.com> wrote:
> On Jul 18, 9:04 am, Bill Marcum <marcumb...@bellsouth.net> wrote:
>
> All my terminals are xterms, but sometime the backspace binding is
> changed during launching the new xterm. Do we have the way to preset
> the backspace key to prevent it changing in a script?


Maybe sometimes it starts with "xterm -ls" or maybe sometimes with
"xterm +ls". I'm not sure if that would cause your problem though.

  Réponse avec citation
Vieux 23/07/2007, 10h24   #7
Stephane CHAZELAS
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: backspace key binding

2007-07-17, 13:53(-07), wenmang:
[...]
> In my profile, "erase" is set to "set erase '^h'" which is working for
> most of times. But, sometime, I use xterm to create a new terminal and
> the backspace key is set to "^?" instead for unknown some reasons, my
> platform is Redhead Linux, not sure why it happens and how to prevent
> it happening. thx.


On Linux, ^? is the default erase character for the
(pseudo-)terminal driver, so xterm is right to issue that
character when you press Backspace. That's rather your other
terminal emulator that is behaving strangly.

If you use ^H, that means that you also need to tune your
terminal driver so that it considers ^H and not ^? as the erase
character.

Now you can configure xterm to issue ^H as well if you want.
This can be done via resources. See xterm's man page for
details.

--
Stéphane
  Réponse avec citation
Vieux 23/07/2007, 10h32   #8
Stephane CHAZELAS
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: backspace key binding

2007-07-20, 06:37(-07), wenmang:
[...]
>> case "$TERM" in
>> *xterm*) stty erase '^?' ;;
>> "") ;;
>> *) stty erase '^h' ;;
>> esac
>>

[...]
> All my terminals are xterms, but sometime the backspace binding is
> changed during launching the new xterm. Do we have the way to preset
> the backspace key to prevent it changing in a script?


That's rather strange maybe something is installing resources in
the X server.

What does

xrdb -q | grep -ie delete -e backspace -e erase

give you

How are your xterms started?

Are some TERMINFO, TERMCAP variables defined by some of your
login scripts. I think by default xterm will look up its own
terminfo entry (for the kbs entry) to determine what character
to send upon <Backspace>.

Does: echo "$TERM" output the same in all your xterms?
what about tput kbs | od -b ?

What I would recommand you do is have all your terminal
applications output ^? upon <Backspace> as it's Linux's terminal
driver default, make sure all the terminfo entry are consistent
with that. And make sure there's no "stty erase" in any of your
startup scripts (think of the ones in /etc as well).

--
Stéphane
  Réponse avec citation
Vieux 23/07/2007, 20h48   #9
Stephane CHAZELAS
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: backspace key binding

2007-07-23, 09:32(+00), Stephane CHAZELAS:
> 2007-07-20, 06:37(-07), wenmang:
> [...]
>>> case "$TERM" in
>>> *xterm*) stty erase '^?' ;;
>>> "") ;;
>>> *) stty erase '^h' ;;
>>> esac
>>>

> [...]
>> All my terminals are xterms, but sometime the backspace binding is
>> changed during launching the new xterm. Do we have the way to preset
>> the backspace key to prevent it changing in a script?

>
> That's rather strange maybe something is installing resources in
> the X server.

[...]

Or are you using screen by any chance?

Or something changing the DECBKM (DEC back arrow mode) in one of
your startup scripts.

printf '\033[?67h'

Should set the DECBKM state to use ^H.

Another thing to consider is working with other systems that
have different defaults and different terminfo entries.

Applications like telnet can do the translation on the fly but
they are rarely properly configured to do so.

What you need to know is that you can configure about
everything.

You can query xterm for which character it sends with an escape
sequence (can be done with the tset command), and configure its
default by X resources or dynamically using tset again or
control sequences.

You can query the terminfo database (a database describing to
visual applications the behavior of terminals) using the tput
and infocmp commands. You can configure it with the TERMINFO
variable and the



--
Stéphane
  Réponse avec citation
Vieux 25/07/2007, 16h31   #10
wenmang
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: backspace key binding


> printf '\033[?67h'


Above line works now, thanks a lot.

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h36.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 2,78799 seconds with 18 queries