bash script - spawn, send, interact - commands not found error

Posted by Sandeepan Nath on Server Fault See other posts from Server Fault or by Sandeepan Nath
Published on 2011-01-05T10:38:09Z Indexed on 2011/01/05 10:55 UTC
Read the original article Hit count: 370

Filed under:
|
|
|

I my shell script, I am trying to remove password prompt for scp command (as given in http://stackoverflow.com/questions/459182/using-expect-to-pass-a-password-to-ssh/459225#459225) and this is what I have so far :-

#!/usr/bin/expect
spawn scp $DESTINATION_PATH/exam.tar $SSH_CREDENTIALS':/'$PROJECT_INSTALLATION_PATH
expect "password:"
send $sshPassword"\n";
interact

On running the script, I am getting errors

spawn: command not found
send: command not found
interact: command not found

I was also getting error expect: command not found also, then I realised the path to expect was not correct and expect was not installed at all. So, I did yum install expect, corrected the path and the error was gone. But not able to remove the other 3 errors still.

© Server Fault or respective owner

Related posts about linux

Related posts about bash