title: Bash: How to end infinite loop with any key pressed?
body: <p>I need to write an infinite loop that stops when any key is pressed.</p>
  
  <p>Unfortunately this one loops only when a key is pressed.</p>
  
  <p>Ideas please?</p>
  
  <pre><code>#!/bin/bash
  
  count=0
  while : ; do
  
      # dummy action
      echo -n "$a "
      let "a+=1"
  
      # detect any key  press
      read -n 1 keypress
      echo $keypress
  
  done
  echo "Thanks for using this script."
  exit 0
  </code></pre>