On Wed, Jul 30, 2003 at 09:06:24AM -0700, pnelson wrote:
> On Wed, 2003-07-30 at 02:48, anil garrepally wrote:
> > Can anyone tell me how to write a  Bash script, that will do 
> > telnet login to one machine and do some activity on that logged 
> > machine.
> > 
> > I was informed that .telnetrc file will help,if so what is the 
> > entry i should add in to that file.
> > 
> > where can i found Any kind of information related to scripting for 
> > Networking activities.Any help would be appreciated.
> 
> Investigate expect a very powerful tcl extension.

Absolutely - here is a primitive example.  This script returns the count
of emails waiting on your pop server.  I used to use it in a script
that would run "fetchmail"



################# CUT HERE
#!/usr/bin/expect

log_user 0
eval spawn telnet -l myusername pop.my_isp.com 110
expect "ready."
send "user myusername\r"
expect "PASS"
send "pass MYPASSWORD\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
#
################# CUT HERE


> 
> 
> -- 
> redhat-list mailing list
> unsubscribe mailto:[EMAIL PROTECTED]
> https://www.redhat.com/mailman/listinfo/redhat-list
> 

-- 
Jeff Kinz, Open-PC, Emergent Research,  Hudson, MA.  [EMAIL PROTECTED]
copyright 2003.  Use is restricted. Any use is an 
acceptance of the offer at http://www.kinz.org/policy.html.
Don't forget to change your password often.


-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to