title: expect script + how to ignore strings if not appears
body: <p>I write the following expect script in order to automate ssh login to remote Linux machine
  And run the command  "cat /etc/APP_VERSION.txt file"</p>
  
  <p>Sometime I not asked from ssh command about-</p>
  
  <pre><code>    "Are you sure you want to continue connecting (yes/no)?"
  </code></pre>
  
  <p>So in this case the first expect still wait for the string "(yes/no)?"    -:(</p>
  
  <p>And not continue to the second expect - "password:" ?</p>
  
  <p>How to resolve this? ,</p>
  
  <p>I mean if the line "Are you sure you want to continue connecting (yes/no)?"
  Isn’t appears from ssh</p>
  
  <p>Then we must go to the next expect "password:" , but how to do this?</p>
  
  <p>remark1 - in case the question "Are you sure you want to continue connecting (yes/no)?" ,    Appears then the expect script work fine without any problem
  .</p>
  
  <p>remark2 - I can’t use timeout positive value (as timeout 10) because ssh itself have delay</p>
  
  <p>.
  .
  .
  .</p>
  
  <p>My expect script: (this expect is part of my ksh script)</p>
  
  <pre><code>  .
    .
    .
  
    APP_MACHINE=172.12.6.190  
  
  
    set timeout -1
    spawn  ssh $APP_MACHINE  
         expect {
                  "(Are you sure you want to continue connecting yes/no)?" 
                                { send "yes\r" }
                }
         expect password:        {send PASS123\r}
       expect &gt;  {send "cat /etc/APP_VERSION.txt\r"}
     expect &gt;    {send exit\r}
    expect eof
  
   .
   .
   .
  </code></pre>
  
  <p>.
  .
  .
  .
  .</p>
  
  <p>example of ssh from my linux machine</p>
  
  <pre><code>  ssh APP_MACHINE
    The authenticity of host 'APP_MACHINE (172.12.6.190 )' can't be established.
    RSA key fingerprint is 1e:8a:3d:b3:e2:8c:f6:d6:1b:16:65:64:23:95:19:7b.
    Are you sure you want to continue connecting (yes/no)?
  </code></pre>