I am trying to log output from an interactive command-line program; units, specifically.
I have tried using tee like this:
or script like this:
but they both log all the backspaces and tab completions as special characters like this:
The manpage for script mentions this issue.
I am aware of the work-around with cat and more mentioned here:
http://stackoverflow.com/questions/7152339/format-output-from-unix-script-command-remove-backspaces-linefeeds-and-delet
As well as the perl script here:
http://log.guidoderosa.net/2009/05/another-old-post-which-may-be-useful.html
But I don't especially want to fix an existing log file: I want to avoid creating new log files garbled with deleted input and control characters.
I thought I had fixed the problem using rlwrap, but it conflicts with the units readline functionality, so that it either fails to capture the output, or with rlwrap -a it captures the output but negates the ability of units to use tab-completion. rlwrap -a -N does not help. This is well-documented in the man page:
Is there any way to cleanly log interactive input and output that doesn't mess with the existing readline functionality?