Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-02-2005, 06:57 PM
|
#1
|
|
Member
Registered: Oct 2004
Posts: 77
Rep:
|
interacting with prompt
hi
I have a program which basically opens a new prompt, say like gnuplot would. now I want to be able to send commands to that prompt and retrieve the output and write it to a file.
anyone a suggestion on how to do that?
quarry 06
|
|
|
|
08-02-2005, 07:12 PM
|
#2
|
|
Member
Registered: Jun 2004
Location: Chicago
Distribution: Gentoo
Posts: 53
Rep:
|
like this
ping google.com --> googleping.txt
|
|
|
|
08-02-2005, 07:26 PM
|
#3
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Re: interacting with prompt
Quote:
Originally posted by quarry_06
hi
I have a program which basically opens a new prompt, say like gnuplot would. now I want to be able to send commands to that prompt and retrieve the output and write it to a file.
anyone a suggestion on how to do that?
quarry 06
|
You'll be looking at script to record the session, and
expect for interaction.
Cheers,
Tink
|
|
|
|
08-02-2005, 07:38 PM
|
#4
|
|
Member
Registered: Oct 2004
Posts: 77
Original Poster
Rep:
|
Re: Re: interacting with prompt
Quote:
Originally posted by Tinkster
You'll be looking at script to record the session, and
expect for interaction.
Cheers,
Tink
|
Sorry, I don't understand. looking at What script? recording is ok, but I need to send multiple commands to this prompt.
I guess I haven't explained very well.
I call gnuplot from a shell script. then I want to type into the gnuplot prompt, but from withing my shell script.
thanks
Last edited by quarry_06; 08-02-2005 at 07:41 PM.
|
|
|
|
08-02-2005, 07:44 PM
|
#5
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Re: Re: Re: interacting with prompt
Quote:
Originally posted by quarry_06
Sorry, I don't understand. looking at What script? recording is ok, but I need to send multiple commands to this prompt.
I guess I haven't explained very well.
I call gnuplot from a shell script. then I want to type into the gnuplot prompt, but from withing my shell script.
thanks
|
That's where expect comes in ...
It allows you to script interactive sessions.
Cheers,
Tink
P.S.: Could you please a) shorten your sig and b) stick
with English? Thanks.
|
|
|
|
08-02-2005, 07:48 PM
|
#6
|
|
Member
Registered: Oct 2004
Posts: 77
Original Poster
Rep:
|
i still don't understand your expect, but I found what I was looking for.
It is called a "here" function
and goes like this
gnuplot
<<**
do
whatever
you
want
to
do
**
can you still explain what your explain does/how it works?
and hey, I would love it if other users had sigs in other languages, so I could learn something new !
anyway thanks
|
|
|
|
08-02-2005, 07:55 PM
|
#7
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
Quote:
Originally posted by quarry_06
i still don't understand your expect, but I found what I was looking for.
It is called a "here" function
and goes like this
gnuplot
<<**
do
whatever
you
want
to
do
**
can you still explain what your explain does/how it works?
|
I don't know how GNU Plot works ... here documents are
going to be fine for one-of activities. If you for example
have something that will ask something, expect input, do
some more, then ask something new expect is the tool
for you. ...
Quote:
Originally posted by quarry_06
and hey, I would love it if other users had sigs in other languages, so I could learn something new !
anyway thanks
|
Good for you :) ... however, it would be a bit
much to ask of mods to learn all possible lingos
on the boards to make sure the contents is OK ;}
Cheers,
Tink
|
|
|
|
08-02-2005, 09:47 PM
|
#8
|
|
Member
Registered: Jun 2004
Location: Chicago
Distribution: Gentoo
Posts: 53
Rep:
|
no seirously!
open your home folder
open a terminal and cd to your home folder
type
Code:
ping google.com --> googleping.txt
it will place all out put into the file called googleping.txt
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 09:50 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|