I have a question about how the computer uses an open pipeline with the bash shell. Suppose I have a "master" program # 0, and a series of slave programs # 1, # 2, # 3 ... And also, the result of # 1 is used by # 2, # 2 by # 3, and so on. If my program # 0 opens a pipeline sequentially with 1,2,3, etc and sends them running in a way like this:
PROGRAM # 0:
...
pipe=popen("bash","w");
fprintf(pipe,"./programa#1 \n");
fprintf(pipe,"./programa#2 \n");
fprintf(pipe,"./programa#3 \n");
.
.
.
...
So, how does the computer manage the fact that orders are "accumulated" sent to bash? Do you have a buffer? If after each fprintf I write fflush (pipe), will I guarantee that the commands arrive at the shell in the correct order?