title: Retry a Bash command with timeout
body: <p>How to retry a bash command until its status is ok or until a timeout is reached?</p>
  
  <p>My best shot (I'm looking for something simpler):</p>
  
  <pre><code>NEXT_WAIT_TIME=0
  COMMAND_STATUS=1
  until [ $COMMAND_STATUS -eq 0 || $NEXT_WAIT_TIME -eq 4 ]; do
    command
    COMMAND_STATUS=$?
    sleep $NEXT_WAIT_TIME
    let NEXT_WAIT_TIME=NEXT_WAIT_TIME+1
  done
  </code></pre>