Re: [Expect] Need to have explanations for the use of the expect command
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: [Expect] Need to have explanations for the use of the expect command

From: Glenn Jackman <xx087@freenet.carleton.ca>
Date: Wed Mar 15 2006 - 18:20:06 CET

At 2006-03-15 11:42AM, Andrew Falanga <not_real@hp.com> wrote:
> #! /usr/bin/expect
>
> set host [lindex $argv 0]

Try adding here:
    exp_internal 1

> spawn ssh root@$host "cd logs; ls"
>
> expect {
> -re password { sleep 1; exp_send "password\r" }
> }
>
> Actually, that's not just basically the script, it is the script. As
> far as I can tell, this isn't working. The script does spawn the ssh
> process, but when the prompt comes for root's password, it just sits
> there for 5 or 10 seconds and then, apparently, times out.

There will be copious output, but look for something like:
    did <big long string> match 'password'? no

You may not be expecting the right thing.

-- 
Glenn Jackman
Ulterior Designer
Received on Sun Apr 30 02:34:01 2006