While looking into a shell redirection problem, I found a couple of answers that pointed me to the
script command. As I understand it, script just records in- and output of the terminal, and allows me to read that from a file later. It covers some edge cases that don't work with regular bash redirection (
2>&1 > /tmp/log), but, from the man page:
Certain interactive commands, such as vi(1), create garbage in the typescript file. Script works best with commands that do not manipulate the screen, the results are meant to emulate a hardcopy terminal.
Similarly, also from the man page and probably related:
Script places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects.
Is there a better way to record an interactive terminal program that also catches output from sub-processes, but doesn't suffer from these problems? Are there alternatives to