Summary: Expect Script problems

From: ABENOJA, ROBERT (PBIS) <ra7839_at_sbc.com>
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.

e.g.:

> #!/usr/local/bin/expect
> log_file -noappend "telnetoutput.txt"
> spawn telnet 138.10.12.144
> 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 <jmglov@incogen.com>

Associate Systems Administrator
INCOGEN, Inc.




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


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:

#!/usr/local/bin/expect
log_file -noappend "telnetoutput.txt"
spawn telnet 138.10.12.144
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
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
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