title: what's wrong with this nested while loop in bash?
body: <p>As shown below, first loop aims at reading steps from a text file while the second loop is intended to accept an option from user according to what user has seen on the screen, and do something, say configuring package.use or something else, and then go on executing the next step, until the end of steps.  </p>
  
  <p>The problem is the second while loop will neither show up options nor continuously read steps from text file, it just exits both of while loops after executing first step of steps, in this case, it shows up the result of executing <code>emerge --pretend ceph</code> and exits both of loops.</p>
  
  <p>steps text file:</p>
  
  <pre><code>ceph
  jdk
  firefox
  ...
  </code></pre>
  
  <p>nested while loop:</p>
  
  <pre><code>#/bin/bash
  STEPS="./steps"
  while read -r line;
  do
      if [[ ! $line = "#"* ]]; then
                  emerge --pretend $line
                  while read -p 'Please choose something:(1:package.use  2:package.license  3:package.keywords) ' input;
                  do
                  case $input in
                          1) echo "$input has been chosen." 
                             #set up package.use
                          ;;
                          ...
                  esac
                  done
          fi
  done &lt;$STEPS
  </code></pre>