Utility to keep all typed command lines.

John F. Haugh II jfh at rpp386.cactus.org
Wed Jan 3 17:25:58 AEST 1990


In article <1990Jan2.180615.28396 at ux1.cso.uiuc.edu> gorham at uiucme2.UUCP (Gorham P. Miscall) writes:
>In article <1527 at utkcs2.cs.utk.edu> battle at alphard.cs.utk.edu (David Battle) writes:
>>I would like to have an accounting utility which will keep not only
>>the name of the command run but also the arguments, especially for commands
>>typed at a shell by a human (as opposed to coming from a command file).
>
>	The following was taken out of the January issue of UNIX World.  It
>works very well for me:
>
>	This captures all I/O of a terminal session to "Capture.file"
>
>	tee -a Capture.file | sh -i 2>&1 | tee -a Capture.file
>
>Hope this does the trick for you!

Not likely.  This command will have the nasty side-effect of causing
your standard input and standard output to no longer be terminals.
Try editing a file using vi in such a capture program.

For a capture program to really work it needs to use pty's.  Pipes
won't cut it.

The trick is to grab a pair [ one for input, the other for output ]
of ptys.  On one end you read from the original input in raw mode,
and shove it through the pty.  The other end reads the output of the
pty.  Both ends have a file open for append which they duplicate all
of the characters each sees into it.  Writes on this capture file
are unbuffered to preserve the relationship between the characters.

For more details see the Berkeley script command.  I also have one
using pipes, but as I mentioned above, it doesn't work completely.
-- 
John F. Haugh II                             UUCP: ...!cs.utexas.edu!rpp386!jfh
Ma Bell: (512) 832-8832                           Domain: jfh at rpp386.cactus.org



More information about the Comp.unix.wizards mailing list