How can I make the builtin
read command support history, by pressing the up/down key to cycle through them?
I've tried catching when you press the up key, however it doesn't seem to work with
read -p '> ' -n 3 foo echo echo -n "$foo" | hexdump
Pressing the arrow keys seems to work and I can detect it using this, however if I press aa↑, it will fail as it will only read the first character of the identifier of the up-arrow, while the third is needed to distinguish the different arrow keys.