title: shell script expect and spawn commands
body: <p>Actually i am writing 2 scripts of </p>
  
  <p>a.sh</p>
  
  <pre><code>#!/bin/sh
  
  PASSPHRASE="PASS"
  for i in 1 2
  do
  echo "say hii:"
  done
  </code></pre>
  
  <p>another script of 
  b.sh</p>
  
  <pre><code>#!/usr/bin/expect -f
  
  spawn ./a.sh
  sleep 2
  for {set x 1} {$x&lt;3} {incr x} {
  expect "say hii:"
  send "hii\r"
  sleep 10
  interact
  }
  
  executing ./b.sh
  </code></pre>
  
  <p>so for the first time it is sending <code>say hii: "and we are sending hii"</code></p>
  
  <pre><code>for the second time it getting struck in say hii:
  </code></pre>
  
  <p>so i would like to send two times means how many time for loop is there.</p>