In the context where I want to capture the stdout of a process in a file but still want to have this output displayed in the terminal I can choose between script
and tee
. In this context, are these tools essentially equivalent or is there a – possibly subtle – reason to prefer one over the other?
The programs script
and tee
are designed for different purposes:
script
-- make typescript of terminal sessiontee
-- pipe fitting
Important differences between script
and tee
are:
script
transmits the exit status of the process it supervises, whiletee
, being a filter, does not even know about it.script
captures stdin, stdout, stderr of the process it supervises whiletee
only catches the stream it filters.
None of these differences are relevant in the given context.