LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Need help with expect script (https://www.linuxquestions.org/questions/linux-newbie-8/need-help-with-expect-script-4175505253/)

mangal023 05-16-2014 04:58 PM

Need help with expect script
 
Hello,

I'm trying to test expect script which i have written. I'm using a ssh session connect. Below is my script:

#!/usr/bin/expect -f

spawn ssh "domain\username"@localhost
expect "?assword:"
send "$PWD\r"
expect "$"
send "date\r"
expect "$"
send "exit\r"


When i execute this script, I'm getting an output like this:

extra characters after close-quote
while executing
"spawn ssh "domain\username"@localhost
expect "?assword:"
send "$PWD\r"
expect "$"
send "date\r"
send "e..."


Can someone help me out...

Thanks

jefro 05-16-2014 08:53 PM

I usually use autoexpect. Try it maybe.

Do those commands work correctly from shell?

Some ideas on a quite similar question. http://stackoverflow.com/questions/4...to-ssh-command


All times are GMT -5. The time now is 07:58 PM.