0

So if I am in my terminal and run:

$ my_proc | grep foo

in my_prof I know it's part of a pipeline because stdout is not attached to the terminal but to grep. On the other hand, if I just run this:

$ my_proc 

in the terminal, then stdout is attached to the TTY, so I know that it's not part of a pipeline.

However, if I run my_proc programmatically outside of the context of a terminal, how can I know if it's part of a pipeline or not?

Or perhaps a better way to phrase the question, is there a way to discover what device/process is listening to the stdio from my_proc?

peterh
  • 9,731
  • What platform are you using? You can [edit] your question. – Michael Homer Jul 18 '19 at 06:44
  • Also, can you be more precise about what you want? What does it mean to run it "programmatically"? Do you want to know if it's part of a pipeline, or discover the process at the other end? This question is related, and may answer your first question, but perhaps not the second. – Michael Homer Jul 18 '19 at 06:55

0 Answers0