title: Why does a bash script continue running even though a dialog box is displayed on the screen waiting for an input from the user?
body: <p>I have a bash script I'm using on Mac OS X (X.5 thru X.8) machines. In it is a dialog situation asking to continue the script by pressing "OK" or letting the script snooze by pressing "snooze". That part is working. </p>
  
  <p>However, I was testing the script and wasn't able to press either button immediately and after a minute or two (i didn't time it), the script continued with the rest of process, letting the dialog stay on the screen. </p>
  
  <p>I was under the impression that the script had to wait for user input?</p>
  
  <p>Part of the script in question:</p>
  
  <p>osascript -e 'tell app "Finder" to activate'</p>
  
  <p>return=<code>osascript -e 'tell app "Finder" to display dialog "Text goes here. Please select OK or Snooze" buttons {"OK", "Snooze"} default button 1 with title "Text Here" with icon caution'</code></p>
  
  <pre><code>    ############  BEGIN LOOP HERE  ##############
  </code></pre>
  
  <p>while [ "$return" == "button returned:Snooze" ]</p>
  
  <pre><code>        do
          Runs every 4 hours
          sleep 14400
          osascript -e 'tell app "Finder" to activate'
          return=`osascript -e 'tell app "Finder" to display dialog "Text goes here. Please select OK or Snooze" buttons {"OK", "Snooze"} default button 1 with title "Text Here" with icon 2'`
  </code></pre>
  
  <p>done</p>
  
  ######  END LOOP HERE
  
  <pre><code>    if [ "$return" == "button returned:OK" ]
          then
                      run the installer script here
              fi
  </code></pre>