Summary: Expect Script problems

Date: Tue May 28 2002 - 17:34:49 EDT
I want to thank all those who responded.  I had an error in my script below
(expect -r "$prompt" it should be expect "machinename%" - sorry about that).
Josh Glover's hint's helped fix the problem.

Have you tried adding a short sleep before sending the password? This 
has helped me before.


> #!/usr/local/bin/expect
> log_file -noappend "telnetoutput.txt"
> spawn telnet
> expect "ogin: "
> sleep 1; send "dude\r"
> expect "assword: "
> sleep1; send "dude\r"
> expect -r "$prompt"
> send "cat /var/adm/messages | grep keyword"
> send "exit\r"

Worth a shot, maybe.

Josh Glover <>

Associate Systems Administrator

Thank you,
Bob Abenoja
PBIS Tech Supoort - San Ramon CA

Original Message:

Dear Sun Gurus,

I have just installed expect 5.25 along with tcl-8.0 
and tk-8.0 on a solaris 2.6 sparc 5.

I modified a script I saw posted over a month ago.  
Here is a simple copy of my script:

log_file -noappend "telnetoutput.txt"
spawn telnet
expect "ogin: "
send "dude\r"
expect "assword: "
send "dude\r"
expect -r "$prompt"
send "cat /var/adm/messages | grep keyword"
send "exit\r"

The script gets to the password part and stops.  The 
prompt is then returned, almost looking like it tried 
to insert the prompt for the password.  I know the 
password is correct and I also tried another account.  
Can an Expect script expert help me figure this out.

Thank you,
Robert Abenoja
sunmanagers mailing list
Received on Thu May 30 22:12:46 2002

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:44 EST