Redirect the ouput of an interactive command to file and terminal
I have a program that requires user input, which I save to a file by using tee
:
tee program.in | program
I also have to capture stdout and stderr in another file. This does the trick
tee program.in | program > program.out 2>&1
The problem is that the user input is going to be based on what the program outputted before, so the user has to see the programs output 开发者_开发百科in the terminal.
Any idea on how to accomplish this?
Another, more idiomatic tee
:-?, i.e.
tee program.in | program 2>&1 | tee program.out
I hope this helps.
P.S. as you appear to be a new user, if you get an answer that helps you please remember to mark it as accepted, and/or give it a + (or -) as a useful answer.
精彩评论