Re: expect/telnet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 25, 2005 at 02:53:44PM -0600, rado wrote:
> Hey y'all,
> This Project: I have to reset my modem thru a script
> what I can do:
> # I can telnet into the modem
> it asks me for my password
> then I gotta hit "r" to reset
> then I gotta hit "y" as a confirmation
> then it's done and I am back at the shell prompt
> 
> ....need to get turned on to a very basic get me started tutorial 
> ....and maybe after that, w/luck, a really good telnet example in a
> script.


> I just need a good point in the right direction...google and the man
> page didn't do me too much

Google didn't help you find an expect tutorial ?

Are you sure you spelled google correctly?

The best source of information on Expect is the book Exploring Expect by
Don Libes published by O'Reilly. It contains an excellent tutorial on
Expect and it's underlying language Tcl


Here is a telnet example that returns the number of emails in your pop
"account":


#!/usr/bin/expect 

log_user 0
eval spawn telnet -l myname pop.my_ISP.com 110
expect "ready."
send "user myname\r"
expect "PASS"
send "pass secret\r"
expect "welcome"
send "stat\r"
expect "+OK "
expect -re "\[0-9]* "
set answer $expect_out(0,string)
send_user "$answer \r\n"
expect -re "\[0-9]*\r\n"
send "quit\r"
expect "signing off"
exit


> 
> thx,
> john rose
> -- 
> ...and I woke up 2 days later, in the back yard, talkin to Elvis!
> 
> -- 
> fedora-list mailing list
> fedora-list@xxxxxxxxxx
> To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
> 

-- 
"The only system which is truly secure, is one which is switched off
and unplugged, locked in a titanium lined safe, buried in a concrete
bunker, surrounded by nerve gas and very highly paid armed guards. Even
then, I wouldn't stake my life on it" - Gene Spafford 
(Good thing. the law of unintended consequences: A laptop, w/wireless
NIC and wake on "date" set in the BIOS)

Jargon file, abrgd.: The September that never ended. On the Internet,
every September's freshmen influx got their first accounts and, not
knowing how to post/email, always made a nuisance of themselves. Usually
they were trained in a few months. But in September 1993, AOL users
became able to post, overwhelming the capacity to acculturate them; to
those who recall the period before, this triggered a decline in the
quality of online communications. Syn. eternal September.

http://kinz.org
http://www.fedoranews.org
Jeff Kinz, Emergent Research, Hudson, MA.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux