0

This question already has an answer here:

I am running a c program using this script

#!/bin/bash
tail -f -n +1 inputFile | ./output

and my program is

#include <stdio.h>
int main()
{
printf("Hello world!");
return 0;
}

It should get terminated immediately after running because there is nothing to read in this program.

But what happens is, it does get terminated unless i give some input to the inputFile i have used to redirect to my program.

Why, i am having this behaviour?

marked as duplicate by Stéphane Chazelas bash Mar 9 '18 at 15:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Browse other questions tagged or ask your own question.