Backspace and Delete key mappings

unix

    Next

  • 1. make a shellscript beep
    Hi, I want to make a shell script beep. (systembell). Now in dos (sorry) you could type (cat) a txtfile containing an ascii 07 character to beep, but that doesn't seem to work in linux. Anyone any idea? Thanks Willem Kossen
  • 2. another question regarding find and mv
    Using the following script, how can I for example move files based on the month they were created or modified in? If my script could find out what the month is and then create a directory using the month as the name of the directory and move those files to the directory created would be wonderful. Then I guess after so many days maybe 60 or 90 days I could have a script that removes the directories created so as to not have too many files stored would no longer be needed anyway. Here is my script I am using right now: find /pbs/exchange/tmp -type file -a -mtime +30 -a -name "BV*" -print|xargs -i - t mv {} /pbs/exchange/bviewarchives >> /tmp/purge_pbsexchange.log 2>&1 I am thinking before I did the mv part of this script I would want to do a mkdir first based on the month that was found. I do not know how to extract out the month, etc. Any help would be greatly appreciated.
  • 3. Find all files .c .cc .h .hh .tcl
    Hi, I want to find out all the files with the extensions .c .cc .hh .h and .tcl. The command find . -name "*.[ch]*" -print will find all files with the extension .c .cc .h .hh (or .ccccc or .hhhh) but not .tcl Any help? Regards Shuva.//

Backspace and Delete key mappings

Postby dmarkh » Sun, 02 Apr 2006 05:39:01 GMT

I have read much on the subject of these 2 keys. Yet I have not been
able to do what I need to do. I need the backspace key to generate
0x08(^H)  and the delete key to generate 0x7f(del) during the execution
of a single  application. On all my linux boxes the backspace generates
0x7f(^?) and the del key generates  ^[[3~. I need to be able to change
that before I execute my program then change it back when my
application is done.  stty does NOT do the job nor does my application
use termdef. I have found a little expect script that does do what I
need. I execute "script program" and the keys come out like I want.

#!/usr/bin/expect

eval spawn -noecho $argv

interact {
 \177        {send "\010"}
 "\033\[3~"  {send "\177"}

However I am really looking for basic Linux commands that can be
executed from the bash shell that will do the same thing or a method of
making my application do it from within its self.

Thanks and regards
Mark


Re: Backspace and Delete key mappings

Postby Mitch Johnston » Mon, 03 Apr 2006 17:36:55 GMT




You can use 'stty' to set it:

stty erase {key}

.\\itch - Pain - finally, something we can depend on.

-- 
.\\itch Johnston - Bearded Dragon

Re: Backspace and Delete key mappings

Postby dmarkh » Mon, 03 Apr 2006 17:43:53 GMT

As I noted in the post, stty does not do it.


Re: Backspace and Delete key mappings

Postby Casper H.S. Dik » Mon, 03 Apr 2006 20:55:51 GMT

"Mitch Johnston" < XXXX@XXXXX.COM > writes:



An unfortunate shortcoming of the way UNIX handles ttys is that
you can only have one "erase" key; I'd prefer both backspace and delete
to erase; while most shells do this, other programs do not.

Casper
-- 
Expressed in this posting are my opinions.  They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.

Similar Threads:

1.backspace and delete key mappings

I have read much on the subject of these 2 keys. Yet I have not been
able to do what I need to do. I need the backspace key to generate
0x08(^H)  and the delete key to generate 0x7f(del) during the execution
of a single  application. On all my linux boxes the backspace generates
0x7f(^?) and the del key generates  ^[[3~. I need to be able to change
that before I execute my program then change it back when my
application is done.  stty does NOT do the job nor does my application
use termdef. I have found a little expect script that does do what I
need. I execute "script program" and the keys come out like I want.

#!/usr/bin/expect

eval spawn -noecho $argv

interact {
 \177        {send "\010"}
 "\033\[3~"  {send "\177"}

However I am really looking for basic Linux commands that can be
executed from the bash shell that will do the same thing or a method of
making my application do it from within its self.

Thanks and regards
Mark

2.backspace and delete keys using SSH

I'm having an annoying problem using F-Secure SSH on an AIX 4.3.3
machine.
When logged in via SSH the backspace key doesn't erase the character
shown on screen, it just backspaces over the top, even though AIX
recognises that the character HAS been deleted.  (NB this all works
fine via telnet.)

It doesn't seem to make any difference whether I set the emulator so
that Backspace sends Delete or vice versa, and nothing I have tried
using "stty erase" seems to help either!

I think this may to do with the SSH client rather than AIX tbh, but
does anyone have any idea how to fix it?

Many thanks

David

3.(Somewhat OT) How to fix backspace/delete key in OS/X (Mac)

Yes, this is OT, but it is also a FAQ here.  People having problems with
their backspace key(s).

Anyway, recently started using OS/X on a MacBook.  Use ssh from 'Terminal' to
connect to shell account.  When I hit "delete", it generates: [3~
Now, note that I am well aware of solutions involving "stty erase ...",
but that's not optimal.  The right way to fix this sort of thing is to
fix what character the key sends, not to kludge the remote system to
accept whatever the key currently sends.

Note also that the key generates the right code (127) when hit locally,
but for some reason is translated when sent to ssh.

Has anyone else solved this problem?

4.(Sorta back on topic: 'screen') How to fix backspace/delete key in OS/X (Mac)

In article < XXXX@XXXXX.COM >,
Bill Marcum  < XXXX@XXXXX.COM > wrote:
>On Wed, 15 Aug 2007 06:45:54 +0000 (UTC), Kenny McCormack 
>  < XXXX@XXXXX.COM > wrote:
>>
>>
>> Yes, this is OT, but it is also a FAQ here.  People having problems with
>> their backspace key(s).
>>
>> Anyway, recently started using OS/X on a MacBook.  Use ssh from 'Terminal' to
>> connect to shell account.  When I hit "delete", it generates: [3~
>> Now, note that I am well aware of solutions involving "stty erase ...",
>> but that's not optimal.  The right way to fix this sort of thing is to
>> fix what character the key sends, not to kludge the remote system to
>> accept whatever the key currently sends.
>>
>> Note also that the key generates the right code (127) when hit locally,
>> but for some reason is translated when sent to ssh.
>>
>> Has anyone else solved this problem?
>>
>Does the OSX terminal offer any choice as to what terminal it emulates?

It emulates xterm-color.  This is what I get if I do: echo $TERM
locally, and it is also what I get on the remote end.

Aha!  I just discovered something.  The problem is 'screen'.  The
problem only occurs when I am in 'screen' on the remote machine (which is
all the time...).  If I don't go into 'screen', then the key works
correctly.  So, I think 'screen' must be doing some kind of mapping.

How to fix *that*???

Note: I've used 'screen' for years now (consider it indispensable), but I:
1) Have never used a lot of its arcane features.
2) Don't understand about 2/3 of the man page.

5.'/' become backspace and backspace key insert '~'

I ssh to a solaris 10 computer from a FC6 computer.
The keyboard behave properly when login as root:

root# stty
speed 38400 baud; -parity
rows = 23; columns = 80; ypixels = 0; xpixels = 0;
eol =  eol2 =  swtch < ;
brkint -inpck -istrip icrnl -ixon onlcr tab3
echo echoe echok echoctl echoke iexten

The keyboard behave improperly when login as non-root:
The '/' key acts as the backspace key.
The backspace key insert '~'.
-bash-3.00$ stty
speed 38400 baud; -parity
rows = 23; columns = 84; ypixels = 0; xpixels = 0;
erase = /; eol = ; eol2 = ; swtch < ;
brkint -inpck -istrip icrnl -ixon imaxbel onlcr tab3
echo echoe echok echoctl echoke iexten

$ bash -version
GNU bash, version 3.00.16(1)-release (sparc-sun-solaris2.10)
Copyright (C) 2004 Free Software Foundation, Inc.

Please help to fix it.
Thanks.

6. Backspace and Delete in vi.

7. Delete/backspace on command line

8. How to enable both Ctrl - H and backspace for deleting left on Solaris 10



Return to unix

 

Who is online

Users browsing this forum: No registered users and 77 guest