Sample Header Ad - 728x90

read with history

16 votes
3 answers
4619 views
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: 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.
Asked by Tyilo (6189 rep)
Oct 17, 2012, 03:09 PM
Last activity: Nov 6, 2024, 09:43 PM