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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-18-2005, 06:22 AM
|
#1
|
Member
Registered: Mar 2005
Location: Chicago
Distribution: Gentoo AMD64
Posts: 365
Rep:
|
How to pass data to a console program with multiple inputs?
The title may be a little unclear, but what I want to do is send data to a program that prompts the user several times. I was thinking to send a newline character at the end of each field, but that doesn't seem to work. How is this possible?
|
|
|
08-18-2005, 05:54 PM
|
#2
|
Member
Registered: Jun 2005
Location: Pennsylvania
Distribution: Kubuntu
Posts: 197
Rep:
|
Re: How to pass data to a console program with multiple inputs?
Quote:
Originally posted by juanbobo
The title may be a little unclear, but what I want to do is send data to a program that prompts the user several times. I was thinking to send a newline character at the end of each field, but that doesn't seem to work. How is this possible?
|
It depends on how the program is trying to retrieve the input. If it is just reading from stdin, your method out to work-- however, if it is a program like passwd that forces a read from the console, you might need something like an "expect" script.
|
|
|
08-18-2005, 06:29 PM
|
#3
|
Member
Registered: Mar 2005
Location: Chicago
Distribution: Gentoo AMD64
Posts: 365
Original Poster
Rep:
|
Thanks a lot Carl, you answered my question. Also, how is it possible to automate inputting data into GUI fields?
|
|
|
08-18-2005, 06:39 PM
|
#4
|
Member
Registered: Jun 2005
Location: Pennsylvania
Distribution: Kubuntu
Posts: 197
Rep:
|
Quote:
Originally posted by juanbobo
Thanks a lot Carl, you answered my question. Also, how is it possible to automate inputting data into GUI fields?
|
That is harder to do in some cases. It depends on the toolkit being used. With TK, I believe there is a "send" command you can use to automate applications. With KDE, you can use DCOP ("kdcop" is a good tool for exploring the interfaces). For other GUIs, your milage may vary. I do not know of a universal way to manipulate them.
|
|
|
All times are GMT -5. The time now is 04:04 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
|
|