title: exit from STDIN from bash script when the user want to close it
body: <p>I'm automating the file creation from a bash script. I generated a file <code>rc_notes.txt</code> which has commit messages from two tags and want to re-write that in a new file as <code>rc_device.txt</code>.</p>
  
  <p><strong>I want the user to write the customer release notes and exit from the BASH</strong> <code>STDIN</code> that I prompt in the terminal.</p>
  
  <p><strong>The problem in my script is I'm not able to trap the close of file.</strong></p>
  
  <p>Wondering how to do. I don't want to trap the close signal. I want to enter magic string example:  <code>Done</code> or some string that triggers the closure of STDIN, that exit from the script gracefully. </p>
  
  <hr>
  
  <p><strong>My script:</strong></p>
  
  <pre><code>#/bin/bash
  
  set -e
  
  
  echo "Creating the release candiate text"
  rc_file=rc_updater_notes.txt
  echo "=========Reading the released commit message file=========="
  cat $rc_file
  echo "=========End of the commit message file=========="
  
  echo "Now write the release notes"
  
  #exec  &lt; /dev/tty
  while read line
  do
    echo "$line"
  done &lt; "${1:-/dev/stdin}" &gt; rc_file.txt
  </code></pre>
  
  <p>It does create the file but I need to exit manually by entering <code>ctrl+D</code> or <code>ctrl+z</code>. I don't want to do that. Any suggestions?</p>