Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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.