See A Y2K Problem solved with Expect also.
From: mhgraham@umich.edu (Dances With Crows) Newsgroups: comp.os.linux.misc Subject: Re: Passing command to Telnet with a text file Date: 14 Aug 2000 16:31:39 GMT Message-ID: <slrn8pgbbv.v78.mhgraham@fleabag.nullhouse.org> References: <4k6gpsc0pl7tvorrlq0asa0isivqiodcgi@4ax.com> On Mon, 14 Aug 2000 17:19:54 +0100, Richard Lewis wrote: >Is it possible to pass a series of commands to a telnet session from a >text file? eg. using a command like "telnet <commands.txt", where >commands.txt would consist of a series of commands. [snip] >Any help or pointers appreciated - I'm trying to incorporate this into >a shell script (BASH) if that makes any difference. You want "expect". It's a scripting language designed to automate interactive programs like telnet. There's a tutorial at the URL below: http://myithaca.wordpress.com/2009/06/21/expect-scripting-tutorial/ You can also do what you want by using Perl's Net::Telnet module, I'm sure, but if you want straight bash, it's probably not going to happen unless you monkey with "netcat" quite a bit. HTH, good luck....
-- Matt G|There is no Darkness in Eternity/But only Light too dim for us to see Brainbench MVP for Linux Admin / Those who do not understand Unix are http://www.brainbench.com / condemned to reinvent it, poorly. -----------------------------/ --Henry Spencer
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.
Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.
We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.
Click here to add your comments
Sat Jul 23 14:22:03 2005: anonymous
this is starting to bother me, i think its a conspiracy to make interested parties buy books rather than relay on net borne resources. raycosoft doesnt seem to exist anymore, along with an inordinate number of other tcl/tk/expect resources, anyone have another good tutorial site? I really need it from the ground up, i cant even make expect attach to a process or report what telnet is reporting to me when i run it from the command line. email me at notawwal@yahoo.com, please.
Sat Jul 23 15:43:20 2005: TonyLawrence
Nobody is going to email you. Ask a question on-line, read responses on-line.
There are other atricles here about Expect. use the Search box above.
Don't miss responses! Subscribe to Comments by RSS or by Email
Click here to add your comments
If you want a picture to show with your comment, go get a Gravatar