title: running command with expect
body: <p><br />
  I have created a shell script which will automate login to a remote machine.<br />
  But I need to automate the execution of commands or shell scripts also along with this script.<br />
  What modification do I need to do with shell script for creating a directory(for example!) in the remote machine ?</p>
  
  <pre class="lang-tcl prettyprint-override"><code>#!/usr/bin/expect
  set login "root"
  set addr "10.3.2.0"
  set pw "root"
  
  spawn ssh -t $login@$addr
  expect "$login@$addr's password:"
  send "$pw\r"
  interact
  </code></pre>
  
  <p>Thanks in advance.</p>