dear unix wizards: I have wrestled with the unix
script program for a while, but to no avail. It may be the wrong program altogether, but googling is hard, because script usually just means sh or bash script. my question is easy to explain with an example.
let's say I have the following input file
# cat testscript.scr date dc 100 200 * f q date exit ## well, from scripting
the result should be a log file that contains all the results as if I had typed in each line, waited for the output, then typed the next line, etc.:
sh-3.2$ date Wed Feb 28 10:09:14 PST 2018 sh-3.2$ dc 100 200 * f 20000 q sh-3.2$ date Wed Feb 28 10:09:24 PST 2018
I only want to see the input where it would occur, I want it to be followed by the output, and I want this to work with child processes, too. the script input in effect should simulate (and log) keyboard input whenever the running programs has blocked to await input.
when I try to run commands like
script -k -t 2 outfile.log sh < testscript.scr, it surely does not like this. instead, it repeats the input queue after each program response.
how does one do this?