Ben C wrote:
> On 2006-03-15, Andrew Falanga <not_real@hp.com> wrote:
>>Hello,
>>...
>>The script is, basically,
>>
>>#! /usr/bin/expect
>>
>>set host [lindex $argv 0]
>>
>>spawn ssh root@$host "cd logs; ls"
>>
>>expect {
>> -re password { sleep 1; exp_send "password\r" }
>>}
>
> Most hosts I've logged into put the "password" line with a capital P.
> password doesn't match Password.
>
> Tip: expect -d is very useful for seeing why this kind of thing doesn't
> work.
>
> Otherwise I think the script is OK.
Ok, I'm going to paste in the result of using the -d option:
expect version 5.40.0
argv[0] = /usr/bin/expect argv[1] = -d argv[2] = ./exp.expect argv[3]
= remtest1
set argc 1
set argv0 "./exp.expect"
set argv "remtest1"
executing commands from command file ./exp.expect
spawn ssh root@remtest1 cd logs; ls
parent: waiting for sync byte
parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {24283}
expect: does "" (spawn_id exp4) match regular expression "password"? no
root@remtest1's password:
expect: does "root@remtest1's password: " (spawn_id exp4) match regular
expression "password"? yes
expect: set expect_out(0,string) "password"
expect: set expect_out(spawn_id) "exp4"
expect: set expect_out(buffer) "root@remtest1's password"
send: sending "utah1\r" to { exp4 }
I don't know what exp4 is, nor do I understand what expect_out is.
Thanks for the help.
---------------------------------------------
Andrew R. Falanga (a non-HP employee)
Hewlett-Packard Company
11311 Chinden Blvd.
Boise, Idaho
---------------------------------------------
Please note: The e-mail address is purposely
mangled. I do not wish my account at HP to
become a spam haven.
Received on Sun Apr 30 02:34:16 2006