[RndTbl] UNIX command transcript with canned input, echoed in output?

Gilbert E. Detillieux gedetil at cs.umanitoba.ca
Fri Nov 25 14:16:48 CST 2011

On 2011-11-25 14:07, Bill Reid wrote:
> 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.

I though about "expect", but figured that it might be a bit too 
low-level, and more complicated, than what I'm looking for.  This has to 
be easy enough for novice UNIX users to use.  (It's essentially to run a 
test suite on their programs, written in Prolog.  Yikes!)

I'm also not very familiar with actually coding for "expect" (though 
I've tweaked other people's expect scripts, and at least know a bit 
about how to use it), and the prof is not at all familiar with it.

Would it be easy to write an expect script to do what I want?  (I.e. 
feed the input from a file, line-by-line, to a program, and collect all 
the output, including tty echo, into a file?)


> 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?

Gilbert E. Detillieux		E-mail: <gedetil at muug.mb.ca>
Manitoba UNIX User Group	Web:	http://www.muug.mb.ca/
PO Box 130 St-Boniface		Phone:  (204)474-8161
Winnipeg MB CANADA  R2H 3B4	Fax:    (204)474-7609

More information about the Roundtable mailing list