In my bash script file, I try to use expect
to provide password for ssh
command but it doesn't work. Here is my script:
#!/bin/bash
/usr/bin/expect << EOD
spawn ssh [email protected]
expect "[email protected]'s password:"
send "mypassword\r"
interact
expect eof
EOD
And the output after I execute the script:
[oracle@BTMVNSRV191 Desktop]$ ./login.sh
spawn ssh [email protected]
[email protected]'s password: [oracle@BTMVNSRV191 Desktop]$
Could someone let me know, how to use expect
in my script without changing #!/bin/bash
to #!/usr/bin/expect
?