title: Nested ssh run commands on 2nd server
body: <p>I can only get to hostB from hostA, and I want to run commands on hostB.</p>
  
  <pre><code>ssh -t $hostA ssh -t $hostB "
  
     echo 'Hello World!'
  
     echo 'Test!'
  
  "
  </code></pre>
  
  <p>At the moment, this will connect to hostA then hostB and the script will pause. As soon as i type exit (from hostB) I return to hostA, the 2 echo commands are printed and then automatically exits from hostA.</p>
  
  <p>How can I run commands on hostB?</p>