Q: Recording shell script screen output using "script" command ?

Hello,

I need to capture everything showed on a screen by a shell script which needs user interaction. The shell script performs commads such as rsh so normal redirection to a file does not work.

I know there is a special unix command call "script" which records screen session but the problem is that command creates his own sub-shell, avoiding launching a shell script which a "script" command built in.

For example, how followings lines in the same shell script get as result the ls command in filename.txt ?

#!/bin/ksh
script filename.txt
ls

Any idea or suggestion ???

take the script command out of the shell script.

Thn run it as

script -c <shell script> filename.txt

Sorry, option not available on Solaris 10:

script -c "toRun" salida.txt
usage: script [ -a ] [ typescript ]

Yes, why not just run script before the script?

$ script filename.tst
$ scriptname.sh

I have a similar need.

My users run an interactive bourne shell script, and the decisions they make need to be logged, and those logs need to be emailed.

Currently, the users need to remember to run the "script" command in advance of running the interactive script, then they need to email the output by hand afterward.

I would like to automate this for them so they do not forget to log it, and automatically send the email afterward, which would be possible if my interactive script got to specify the name of the log file.

Any ideas?