Scripted control of 'Telnet'

Scripted control of 'Telnet'

Post by Alan Ro » Fri, 03 Mar 1995 23:18:55



Does anyone know how I can control a telnet session from within a script,
and then return control to the user?  Effectively, what I want is shown in
the following script:-

   #!/bin/ksh
   .
   .
   .
   telnet << !
   set escape ^x
   mode char
   open 123.123.123.123
   !
   .
   .
   .
   Control of telnet session handed to user so that he/she can continue as
if they had put these commands in by hand.

Cheers,

Alan Rowe.

PS. I am running HP-UX 9.04.
--
+------------------------------------+----------------------------------------+

+------------------------------------+----------------------------------------+

 
 
 

Scripted control of 'Telnet'

Post by Joachim Mart » Sat, 04 Mar 1995 00:08:22


: Does anyone know how I can control a telnet session from within a script,
: and then return control to the user?  Effectively, what I want is shown in
: the following script:-

You want 'Expect', a public-domain scripting language that spawns programs
and can interact with them via 'expect' and 'send' commands.  It's based on
Tcl, and available at the Tcl archive:  (I think!)
          ftp://ftp.aud.alcatel.com:/tcl

There's also an O'Reily book, "Exploring Expect" (or something like that)
written by the author.

Good luck -Joachim
-------------------------

Systems Librarian               http://sirin.harvard.edu/~jmartin
Office of Information Systems   Harvard University Library

 
 
 

Scripted control of 'Telnet'

Post by Quentin Fennes » Sat, 04 Mar 1995 06:46:11





>: Does anyone know how I can control a telnet session from within a script,
>: and then return control to the user?  Effectively, what I want is shown in
>: the following script:-

>You want 'Expect', a public-domain scripting language that spawns programs

And to show you how easy it is:

Quote:> #!/usr/sww/bin/expect -f

> set relay gateway.smith.com

> set timeout 60
> set env(TERM) vt100
> log_user 0

> spawn telnet $relay
> expect {
>         "*>" {
>                 send "connect $argv\r"
>                 interact
>         }
> }

--
Quentin Fennessy
http://cactus.org/~quentin/
 
 
 

1. Shell script to 'control' lynx

I would like to write a small script to use lynx to download a file
automatically. (I have free shell access, but have to pay by the
megabyte using a proxy, so I want to save money!)

Currently in my shell account I run

 $lynx URL

where the URL is pasted in after a 'Copy link location' in Netscape.
Lynx happily downloads the file, but then requires user input to type
the filename, and hit Enter.

Can a shell script simulate these keystrokes?

I have looked in lynx for ways around this, but haven't found much.

Ideally, the script will download the file, and add a link to it in a
HTML file, which can then be accessed (for free :)

Look forward to advice, ideas, comments...

Jason

2. Help needed setting up Perl OpenGL

3. ksh scripted sed needs a control J - but I can't write the script!

4. setup and netconfig ???

5. 'ping' sees route but 'telnet' doesn't??

6. prob with IBM 730MB hd + AHA 1542CF

7. Can 'sudo' control 'Directory'???

8. Editing printer interface. Help needed

9. My linux refuses 'rlogin' 'telnet' what is the problem??

10. Problem in getting screen size when 'rlogin' and 'telnet'

11. Where can I find 'Telnet' and 'Slirp' sources?

12. 'telnet' and 'ftp' in RH71?

13. 'w' shows '-' if telnet or rlogin to linux box