title: How to use expect inside bash script
body: <p>Could anybody please tell me why this is not working?</p>
  
  <pre><code>#!/bin/bash
  cd /home
  touch somefile
  /usr/bin/expect&lt;&lt;FILETRANSFER
  spawn scp -r -P remoteServerPort somefile remoteServerIP:/home
  expect "assword:"
  send "MyPassWord\r"
  interact
  FILETRANSFER
  echo "It's done"
  </code></pre>
  
  <p>It doesn't give any error but file is not transferred to remote server.I have tried many ways still couldn't find any solution.</p>