title: Expect not working inside my Bash script
body: <p>I am trying to execute expect command inside by small bash script to login into servers using key authentication method. My script is as follows:</p>
  
  <pre><code>#!/bin/bash
  HOST=$1
  /usr/bin/expect -c "
                      spawn ssh -i /root/.ssh/id_rsa root@$HOST  
                      expect -exact "Enter passphrase for key '/root/.ssh/id_rsa': " ;
                      send "PASSPHRASE\n" ; 
                      interact
                     "
  </code></pre>
  
  <p>Output with error is:</p>
  
  <pre><code>spawn ssh -i /root/.ssh/id_rsa root@server.domain.com
  couldn't read file "passphrase": no such file or directory
  </code></pre>
  
  <p>Can you help to correct this?</p>