1 erase
On my system, the backspace key, as I presses it, sends out ^? or 0x7F, also known as Delete character. Another common is ^H or 0x08 or Backspace. Whichever it is, in the terminal or console, you expect to see one character being deleted.
To check the current key, simply type:
$ stty -a speed 38400 baud; rows 25; columns 118; line = 0; [snip]; erase = ^?; [snip]; werase = ^W; [snip]
You can see erase currently is set to ^?. To change it to something else, say x, yes it doesn’t make sense, but it’s just and example:
$ stty erase x
Now if you type x, it deletes one character; and if you press backspace, the terminal echos out ^? literally as your eyes see. To set back, you can either do:
$ stty erase <you hit backspace> # or simply with two literal charcters "^" and "?" $ stty erase ^? # or if you use Bash $ stty erase $'\x7f'
If your backspace sends out ^H, then use $'\x08' or literal ^H.
2 werase
werase is word erase key, on my sytem, it’s ^W or 0x17 or End of Transmission Block when I press Ctrl+W. I could change it to tab if I want to:
$ stty werase $'\x09'
3 Other special characters?
You can change more than these two, such as Ctrl+C of intr or Ctrl+Z of eof, see:
info coreutils 'stty invocation' 'Characters'
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.