Go back to the left arrow line when using reading?
I am reading stdin from read var
. When I type something, I cannot get back in line by pressing the left arrow on my keyboard. I get test[[D^[[D^[[D
(three clicks on the left arrow). How can this be solved?
Sounds like a question that has probably been asked before, but I didn't get any results in SO suggestions and my google-fu didn't help me.
source to share
The ability to use the arrow keys to move the cursor within entered text is provided by the readline library . The bash command read
doesn't use readline by default, but you can tell it by providing a parameter -e
. So just add this option to the command read
.
source to share