Shell - while loop command not running properly

Hi again,

Im trying to figure out how to make the backspace to work when I have a 'read' clause in my shell script...

For eg. in the script I have:
read variable_a

So when I run it and I enter the variable input, if I hit backspace to correct some mistype mistake I get ^H^H when I hit backspace..

Is there a way to make the backspace to work? Any option in the read clause for eg... ?

Who is Participating?
Which shell are you using?

You can try "read -e var" instead of "read var"  to allow the edits to take place...
Does this happen on the command line too?  If so, try running:

   stty erase ^H

before you run your script.

(you can either do the ^H as a "^" and an "H", or by pressing the backspace key).
joaotellesAuthor Commented:
Both worked.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.