[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

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

From: Andrew Falanga <not_real@hp.com>
Date: Wed Mar 15 2006 - 17:42:12 CET

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?

---------------------------------------------
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:33:56 2006