Basically I would love to say:
echo `grep ^foo /usr/share/dict/words | popup_menu`
...and have some type of keyboard navigable menu popup or selection tool, very similar to how vim's ":Explore" mechanism works.
Extreme bonus points for "easy and works pretty much everywhere with standard tools"
Also acceptable is "needs some sort of extra config file or 5-10 line shell script"
Less acceptable is "go download this perl library or 100 line python script, etc..." at that point, I would rather just try to find some actual program / package to install and list it as a hard dependency. But if you can come up with a 2-5 line perl / python script that doesn't require tracking down libraries that'd probably work too.
I have investigated:
Dialog - appears more geared towards "shell application" instead of ad-hoc scripting (looks like there might be a way to make it do what I want, though), drawback is that it overwrites the current screen state
Curses - seems like it targets "C" or would need to be used as part of a perl / python library, would have to write my own menu program using this
bash "select" builtin - works via number selection, not keyboard navigation, is a little awkward to use but fairly close
Vim - "grep ^foo /usr/share/dict/words | vim -" ... this gets you surprisingly close, just missing "bind the enter key to print current line to terminal and exit"
...so, how do I go about making or finding a decent, simple, ad-hoc menu maker for use in bash scripts and when I'm being lazy on the command line?
... git checkout -b `git branch -a | menu`
... ssh `grep foo /etc/hosts | menu`
... rm `ls | menu` # ignore obvious quoting issues with this...
Edit: thanks for the answers so far, but want to re-emphasize that I'm looking for ASCII / text menus (not xwindows). I'm trying a few things out locally but nothing is hitting the sweet spot yet.