1

I would like to know how can I redirect the stdout of an app to an input of an another app but still see the app1 output.

The source app is written in c, the second app is in perl. The purpose of this, that i would like to interpret the output of the C program with the perl script, and do something based on the input. The problem is if i use the ./c_app | ./perl.pl, so use the | pipe, i can only see the output of the perl script. It's like the perl would swallow the output of the C_app.

I've tried to use the tee, and found some examples, but all of them are based on redirecting the output of the source app to a file, not to an input of an other application.

The below figure illustrate the process, the got and the expected result. enter image description here

A limitation would be that I cannot modify the C app, nor the perl, so i would solve it by using linux stuffs. Is it possible to use the same terminal to see both output? I have no idea how to solve it.

Any recommendation, bash script, etc. would be appreciated.

muru
  • 72,889
iddqd
  • 41

1 Answers1

3

Thanks @steeldriver the recommendation!

The solution is:

./c_app | tee /dev/tty | perl server.pl
muru
  • 72,889
iddqd
  • 41