Sign up ×
Server Fault is a question and answer site for 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.


locked by HopelessN00b Feb 17 at 17:23

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

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

Questions on Server Fault are expected to relate to 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

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
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.