Analysis...
Option 1: you want to capture the output that has been redirected. You were unlucky.
Opportunity 2: you want to capture the output to be redirected. Injection debugging and calling dup2.
Opportunity 3: you are a process. Maybe try / dev / tty
.
source share