This is the small shell script I wrote :
#!/bin/bash
echo "Tell me something"
read -n 1000 text
But when the -n argument is used, I cannot erase my typos as using backspace results in inserting "^?" into the input.
Example input :
t^?This is my ans^?wer
My question here is why does using read with or without the -n argument results in different behaviors and how can I use read with the -n argument so I could normally use backspace ?
Apparently -n
disables Readline, which is normally on by default when stdin is interactive. Use -e
to explicitly enable it.
read -n 1000 -e text