title: How do I read any one key in Bash?
body: <p>I can get <code>read -n 1 KEY</code> to get most keys, except for keys which are represented by multiple characters. For example, if I press the up arrow key:</p>
  
  <pre><code>$ read -n 1; echo
  ^[[A
  $ [A
  </code></pre>
  
  <p>As you can see, <code>read</code> only takes the <kbd>Esc</kbd> and the <code>[A</code> is left over.</p>
  
  <p>What I want to be able to do in a script is:</p>
  
  <ol>
  <li>Go through a list with the arrow keys and press <kbd>Enter</kbd> to do something with it</li>
  <li>For other actions, press different keys.</li>
  </ol>