title: expect command is not working in bash script
body: <p>I have a problem related to expect.</p>
  
  <p>when i run abc.sh which includes following lines </p>
  
  <pre><code>#!/usr/bin/expect
  spawn scp /etc/httpd/conf/httpd.conf 192.168.0.12:/tmp
  ######################
  expect {
  -re "password:" {
  exp_send "PASSWORD\r"
  }
  }
  interact
  </code></pre>
  
  <p>its works fine</p>
  
  <p>but when i use similar code in my running script it doesnt work </p>
  
  <hr>
  
  <pre><code>#!/bin/bash
  clear
  while read -u3 LINE
  do
  code .........
  code .......
  code  ........
  
  REMOTE_COMMANDS1="scp -r -v $BASE_DIRECTORY/$USERNAME $D_IPADDRESS:/home/"
  
  spawn $REMOTE_COMMANDS1
  ######################
  expect {
  -re "password:" {
  exp_send "redhat\r"
  }
  }
  interact
  
  
  done 3&lt; /opt/sitelist.txt
  </code></pre>
  
  <p><strong>it gives error</strong> </p>
  
  <p>./script.sh: line 62: syntax error near unexpected token <code>}'
  ./script.sh: line 62:</code>}'</p>
  
  <p>i think it is due to the fact that i am not including #!/usr/bin/expect in top of the script but if i use this and execute my script it doesnt do any thing and display all of code in terminal after excution. so can we include #!/usr/bin/expect and #!/bin/bash simultaneously ?</p>
  
  <p>Regards, 
  Aditya</p>