I think the TCL expect package might do the trick. It simulates a person entering text in a terminal session. The command and output are intermix as you want.
On 25/11/11 13:56, Gilbert E. Detillieux wrote:
Howdy folks!
I got a request from a prof this morning that stumped this old UNIX hack. He wants to run a UNIX command (for a language interpreter), using input from a file, and saving a transcript of the output. That much is trivial. The catch is that he'd like the transcript to have the input echoed, as if it had been typed in at the tty.
I've looked at options on the script command and ssh, but can't find a simple solution to this. And it has to be simple enough for his students (who may not have much UNIX experience) to use.
Any suggestions?