This answer shows great and intuitive bash menu where you just press number and item is selected. But it's kinda inconvenient for file list, because it's all hardcoded. I'd rather fill my files in some sort of array, then let user pick a number which again maps to array offset.
Basically this is what I imagine:
Following `*.war` archives were found, select one: 1) old.war 2) debug.war 3) release.war Use number to select a file or 'stop' to cancel: blah 'blah' is not a number Use number to select a file or 'stop' to cancel: 2 debug.war installed
But how do I turn list of files into this array thingy:
options=("Option 1" "Option 2" "Option 3" "Quit")
How do I get string at certain offset in
options? How do I ensure user is asked to try again? Can I allow for string
stop to stop selection mode?