Using Expect after SSH : <p>I'm trying to install a pkg file on remote machines. Facing issue while using expect inside ssh. unable to pass the password  while using actual password or variable $pass</p>

<pre><code>#!/bin/bash
agentpath="/Users/vigneshganapathy/Downloads/FS-Agent"
pass="xxx"
expect -c "spawn ssh -o StrictHostKeyChecking=no shyamkarthikv@192.168.57.33
      expect \"*?assword:\" {send \"$pass\r\"; exp_continue}
      spawn sudo installer -pkg \"/tmp/FS-Agent/FS-Agent.pkg\" -target \"/\"
      expect \"*?assword:\" {send \"xxx/r\"; exp_continue}"
</code></pre>
