title: Why can't I read user input properly inside a UNIX while loop?
body: <p>I'm using the bourne shell in UNIX, and am running into the following problem:</p>
  
  <pre><code>#!/bin/sh
  
  
  while read line
     do
  
    echo $line
  
    if [ $x = "true" ]
    then
          echo "something"
          read choice
          echo $choice
    else
          echo "something"
    fi
  
  done &lt;file.txt
  </code></pre>
  
  <p>The problem I have here is that UNIX will not wait for user input in the read command - it just plows on through instead of waiting for what the user types in. How can I make unix wait for user input?</p>