0

With a command as follows:

program_that_produces_stdout | program_that_captures_stdout

I would like to capture the output of program_that_produces_stdout in a file locally too.

Obviously

program_that_produces_stdout | program_that_captures_stdout > some_file

Doesn't work, and tee doesn't appear to be the right tool for the job.

2

tee is the right command, in the right place.

 program_that_produces_stdout | tee some_file | program_that_captures_stdout

If you want to append to "some_file", rather than overwrite it (so ">>" rather than ">") then use tee -a instead.

e.g.

 program_that_produces_stdout | tee -a some_file | program_that_captures_stdout

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.