I want to read in bash when any key is pressed, be it arrow key, number, letter, or punctuation, without pressing enter.
This is the closest that I have come up with, besides that when an escaped key is pressed, it spills over into the next input. Also, escaped keys will read but not echo.
#!/bin/bash
read -r -n 1 -d $'\n' -p 'input> ' line
echo -en "\n"
echo "$line"