Piping input to a shell command and keeping the created shell alive Piping input to a shell command and keeping the created shell alive shell shell

Piping input to a shell command and keeping the created shell alive


Try:

cat file1 - | ./myprog

Many programs recognize the "filename" - to mean stdin.


Do you have access to the C program source code? My guess is that the C program is using istty(0) to determine if stdin is coming from a terminal. It probably only creates an interactive shell when that is the case. Using stdin redirection, whether from a file or a pipe, means that istty(0) returns false.