LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-03-2008, 01:25 PM   #1
mattmarion
LQ Newbie
 
Registered: Mar 2008
Posts: 2

Rep: Reputation: 0
send input to running program


Hello

Here's the deal. I have a program that I want to run. This program takes input from stdin at various times.

I want to be able to run this program but have another program, or preferably a shell sript, handle the job of sending input to this programs stdin. Basically, the program I am running is a kind of simulator. It will eventually run in an embedded system and it will get its input from another chip. The simulator allows me to test the code in linux but it's a pain in the butt having to keep sending the program the lines it requires as responses to the commands it sends out (all ascii text). I'd much rather be able to put together a couple scripts that run the program and then send it ascii strings at various times (when the program sends out a command, I want to be able to automatically answer this via a script).

This doesn't have to be smart at all. The script can be programmed to send responses at various times (i.e. wait 10 seconds then send response).

So far I can see how to pipe the output of a command to the input of another command or how to redirect stdout to a file but what I need to do is to have a script send input to stdin of another program.

That's it, thanks
 
Old 03-03-2008, 01:27 PM   #2
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181Reputation: 1181
I think the feature you want is called a named pipe. I don't recall the details, but I think it is pretty easy. If you do a seach for "named pipe" I think you will find your answer.
 
Old 03-03-2008, 01:54 PM   #3
mattmarion
LQ Newbie
 
Registered: Mar 2008
Posts: 2

Original Poster
Rep: Reputation: 0
You are correct my friend, I had forgotten all about the fact that I could make my own named pipe to use.
 
Old 03-03-2008, 02:03 PM   #4
xkero
Member
 
Registered: Dec 2007
Posts: 30

Rep: Reputation: 15
I'd suggest expect, its a shell that can simulate input when a certain match occurs. It can even hand over control to the user at certain points then go back to being automated. It's a pretty common utility so it should be in your distros package manager.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Wine: How do I input into a running Wine Program with Cyrillic Characters? Riddick Linux - Software 3 08-16-2009 12:58 PM
Send password input via bash script lowlifeish Linux - Software 4 02-22-2007 01:40 PM
Send input to child process cdog Linux - Software 5 02-07-2007 11:00 PM
input avoided in my c program. nflenz Programming 6 12-12-2006 02:47 PM
How do I send input to a web page? wswartz Linux - Software 2 07-16-2004 06:59 PM


All times are GMT -5. The time now is 04:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration