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: Cameron Laird <claird@lairds.us>
Date: Wed Mar 15 2006 - 19:08:02 CET

In article <441843e4$1@usenet01.boi.hp.com>,
Andrew Falanga <not_real@hp.com> wrote:
>Hello,
>
>Back to an issue I'd asked for help on some months ago and I'm just now
>getting back around to it. I went and read through my original post and
>the answers to that post, tried some the suggestions and some new things
>and I'm still at the same place. It's not working and I don't know why.
>
>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" }
>}
>
>
>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.
>
>So, how do I properly use the expect command to give this newly spawned
>ssh process root's password?
                        .
                        .
                        .
A. Are you SURE it's "password" and not, for
    example, "Password:"?
B. <URL: http://wiki.tcl.tk/3173 > (and
    <URL: http://wiki.tcl.tk/autoexpect > and
    so on).
C. THOUSANDS of people succeed in automating
    ssh connections. We'll help you get
    through this.
Received on Sun Apr 30 02:34:16 2006