My question was:
>I'm writing a perl program to be used by operators.
>I want to log everything displayed and the operator
>input, in a file. The idea is to turn on logging in the beginning
>of the program and to turn it off at the end.
>
>I tried to use script command. However, it does not return
>the control to the program until ctrl-d is pressed, as it
>starts another shell. I tried a fork and exec combination
>as a child process. It didn't help either.
>
>Any ideas how to do it?
And the answers with my thanks:
Harry Levinson:
>Check out the script command. If that does not work for you, then you
>might check out expect. It is supposed to be handy for this sort of thing.
I had already mentioned in my question that I tried the script command.
It didn't help. And I don't seem to find expect command. Where is it?
James Harmon:
>On a purely theoretical level (I've not tried it) you might try making
>the invocation use stdout/stderr redirect through "tee" to log messages
>generated by the program while running, and then inside the program,...
Yes I had tried tee too. It does not redirect the user input and
the output from the commands used inside the perl script. True that
tee might be a solution if we use it with each and every command in the
script. Not an elegant solution though..
Rich Kulawiec:
>This is not an appropriate question for the Sun-Manager's mailing list.
I thought my question was rather related to Solaris than to perl,
as some sort of logging means could be provided by the operating system
such as the script command providing the same thing (not in a script though).
My apologies if I was wrong..
As an ex-VMer and a newbie in Unix I must say I am a bit disappointed
to find that logging all the inputs and outputs from a script would
be such a difficult task.
In REXX, we used to turn on logging at the beginning of the program
by issuing a VM command and turn it off at the end. I thought this would
be easily possible in Unix which is richer. But, perhaps, I am making
the mistake of comparing apples with oranges..
Thanx again..
Umit