DISQUS

Tech-Recipes: Use BackSpace Key to Erase characters instead of Delete Key | Solaris system administration | Tech-Recipes

  • mhobbs13 · 5 years ago
    I tried this on my Sun Solaris box after I put stty erase ^H in the .profile I then save the .profile and logout then log back in and I see this -sh: H: not found and I still get ^H when I try to back-space. Can anyone help.
    thanks,
    Michael Hobson
    michael.hobson@its.state.ms.us
  • qmchenry · 5 years ago
    The trick in describing this is that what you see is not what you type. Frequently, editors interpret the backspace (CTRL-H) key as a backspace, even if the shell doesn't. So when you edit the file, you need to escape the control character. If the code is copied and pasted, the literal characters "^" and "H" will be pasted, and this is certainly not what is needed. In an editor, the literal characters ^H and the ^H representing a backspace look the same (although the literal characters are two characters while the backspace ^H is treated as one character while moving the cursor around).

    There are two ways I know of to do this. If you preceed a control character with CTRL-V, the control character will be escaped. For example, pressing CTRL-V and then BACKSPACE will yield a ^H on the screen which represents a CTRL-H. The backslash character () will also escape a control character, so you can type BACKSPACE and you'll also see ^H.

    Let us know if this doesn't help.
    Quinn
  • siva · 5 years ago
    the solution worked. Here it little more clarification on how to set it in .profile. first at the $ prompt type stty erase BACKSPACE, then copy this line and add it to the .profile. Directly typing BACKSPACE in the .profile is not working.

    thanks,
    siva
  • its me · 5 years ago
    i tried this from # prompt, but its in vein. error: "H: not found". i entered it exactly as you mentioned.
  • angelko · 5 years ago
    you should use the following:
    stty erase ^?

    the ^H version is also correct but it works on a different term/keyboard setup.

    =angelko
  • Newbie · 5 years ago
    This solved it for me thanks