Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am new to Shell scripting.How am I supposed to take the output of a c program that i execute and give it as an input to another c program all using shell.

share|improve this question

closed as off topic by Ward, Iain, Zoredache, Chopper3 Jun 20 '11 at 7:34

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

Assuming program1 sends data to stdout and program2 receives data from stdin:

program1 | program2
share|improve this answer

You need to learn about bash pipes and redirection. In particular to pass the output of one program to the input of another use the | operator

program | another_program
share|improve this answer
    
I am also asked to take input from a text file and feed it as input to a cprogram and execute it. how? –  myax Jun 20 '11 at 6:46
    
If you read the links I provided in my answer you will find the answer. –  Iain Jun 20 '11 at 6:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.