title: Shell script successful telnet login, how to issue commands after that?
body: <pre><code>#!/usr/bin/expect -f
  spawn telnet 10.21.0.17
  expect -re "login"
  send "admin\n"
  expect -re "Password"
  send "supersecurepassword\n"
  interact
  </code></pre>
  
  <p>works as expected. Upon running the script I am logged in to whatever telent IP I used in the line <code>spawn telnet 10.21.0.17</code></p>
  
  <p>Then it drops me to the Shell of the AP </p>
  
  <blockquote>
    <p>WAP-></p>
  </blockquote>
  
  <p>How do I issue further commands? I'd like to issue <code>reboot</code> and then maybe a <code>sleep 20</code> and finally <code>exit</code>.</p>
  
  <p>I have tried using <code>echo</code> and <code>expect</code> with no success. I've also tried with removing the <code>interact</code> with no success. Any ideas?</p>