title: reading multiple items semi-interactively from the user in bash
body: <p>I'm trying to read multiple items from the user in a shell script, with no luck.  The intention is to read a list of files first (which are read from the stdin pipe), and then read twice more to get two strings interactively.  What I'm trying to do is read a list of files to attach in an email, then the subject and finally the email body.</p>
  <p>So far I have this:</p>
  <pre><code>photos=($(&lt; /dev/stdin))
  
  echo &quot;Enter message subject&quot;
  subject=$(&lt; /dev/stdin)
  
  echo &quot;Enter message body&quot;
  body=$(&lt; /dev/stdin)
  </code></pre>
  <p>(plus error checking code that I omit for succintness)</p>
  <p>However, this gets an empty subject and body presumably because the second and third redirections get EOF.</p>
  <p>I've been trying to close and reopen stdin with &lt;&amp;- and stuff but it doesn't seem to work that way.</p>
  <p>I even tried using a separator for the list of files, using a &quot;while; read line&quot; loop and break out of the loop when the separator was detected.  But that didn't work either (??).</p>
  <p>Any ideas how to build something like this?</p>