title: Best(?) way to make a popup menu for semi-portable shell scripts?
body: <p>Basically I would love to say:</p>
  
  <pre><code>  echo `grep ^foo /usr/share/dict/words | popup_menu`
  </code></pre>
  
  <p>...and have some type of keyboard navigable menu popup or selection tool, very similar to how vim's ":Explore" mechanism works.</p>
  
  <p>Extreme bonus points for "easy and works pretty much everywhere with standard tools"</p>
  
  <p>Also acceptable is "needs some sort of extra config file or 5-10 line shell script"</p>
  
  <p>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.</p>
  
  <p>I have investigated: </p>
  
  <ul>
  <li><p>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</p></li>
  <li><p>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</p></li>
  <li><p>bash "select" builtin - works via number selection, not keyboard navigation, is a little awkward to use but fairly close</p></li>
  <li><p>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"</p></li>
  </ul>
  
  <p>...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?</p>
  
  <pre><code> ... git checkout -b `git branch -a | menu`
   ... ssh `grep foo /etc/hosts | menu`
   ... rm `ls | menu`  # ignore obvious quoting issues with this...
  </code></pre>
  
  <p><strong>Edit:</strong> 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.</p>