title: expect script + expect miss the send string + delay issue
body: <p>I write the active.ksh script (based on expect) in order to login automatically to some Solaris machine and execute the hostname command (login to virtual IP in order to verify which hostname is the active machine - I have two cluster solaris machines )</p>
  
  <p>The problem is with <strong>expect</strong>; expect sends the password string (pass123) and it misses the Password question, and it still waits for the password.</p>
  
  <p>So actually the password (pass123) was entered after password question. On most cases the expect script works fine but sometimes it missed the password.</p>
  
  <h2>EXAMPLE OF THE PROBLEM</h2>
  
  <pre><code> ./active.ksh
   spawn ssh 10.10.18.61
   sh: /usr/local/bin/stty: not found
   This computer system, including all related equipment, networks and network devices      (specifically including Internet access),is provided only for authorized uss
   Password:        * my remark - pass123 string was missed the Password Question        pass123
   Password: 
  </code></pre>
  
  <h2>THE SCRIPT</h2>
  
  <pre><code>  more active.ksh  
  
  
  
    #!/bin/ksh
  
    VIP_ADDRESS=10.10.18.61
  
  
    expect_for_verify_which_active_machine=`cat &lt;&lt; EOF
    set timeout -1
    spawn  ssh   $VIP_ADDRESS 
    expect {
    ")?"   { send "yes\r"  ; exp_continue  }
    Password:  {send "pass123\r"}
    }
    expect &gt;  {send "hostname\r"}
    expect &gt;    {send exit\r}
    expect eof
    EOF`
  
  
    expect -c  "$expect_for_verify_which_active_machine"
  </code></pre>
  
  <h2>EXAMPLE OF RIGHT RESULTS</h2>
  
  <pre><code>  ./active.ksh 
    [Friday, February 24, 2012  2:32:06 PM IST] INFO Verify which is active SMU machine 
    spawn ssh 10.10.18.61
    sh: /usr/local/bin/stty: not found
    This computer system, including all related equipment, networks and network devices       (specifically including Internet access),is provided only for authorized uss
    yes
    Password: 
    Last login: Fri Feb 24 14:32:06 2012 from smu1a
    This computer system, including all related equipment, networks and network devices       (specifically including Internet access),is provided only for authorized uss
    solaris1:/ ROOT &gt; hostname
    solaris1
    solaris1:/ ROOT &gt; exit
  
    logout
    Connection to 10.10.18.61  closed.
  </code></pre>