title: how to use ctrl-D in a shell script
body: <p>I have a bash shell script that requires ctrl-D to break out of the terminal.can anyone tell me how to use it in the shell script </p>
  
  <h2>example</h2>
  
  <p>ssh host last --->displays the list of users who were logged on to that host </p>
  
  <p>I have different hosts the output is appended to one final and when I'm executing this particular shell script along with other series of commands, i'm using ctrl-D to see the output</p>
  
  <p>suppose my shell script is myscript.sh
  to execute myscript.sh</p>
  
  <blockquote>
    <p>./myscript.sh</p>
  </blockquote>
  
  <p>ctl-D</p>
  
  <p>connection to host closed</p>
  
  <p>output is displayed</p>
  
  <p>Instead, I want to use ctrl-D in my script file</p>