Jump to content

script (Unix)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 149.32.192.37 (talk) at 15:33, 29 January 2014 (Alternatives to Script Command). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The script command is a Unix utility that records a terminal session.[1] The scriptreplay command offers a replay function to script.[2] The session is captured in file name typescript by default; to specify a different filename follow the script command with a space and the filename as such: script recorded_session.

The ttyrec program provides the same kind of functionality and offers several bindings.

Recorded shell sessions can be shared using online services.[3] The advantage of sessions recorded in this format from the usual screencasts is that shell instructions can be easily copy/pasted from the player screen.

Alternatives to Script Command

Bourne shell

All shells related to Bourne shell (namely: sh, bash, and ksh) allow the stdout and stderr to be attacted to a named pipe and redirected to the tee command.

Example

LOGNAME="script"
rm -rf $LOGNAME.p $LOGNAME.log
mknod $LOGNAME.p p
tee <$LOGNAME.p $LOGNAME.log &
exec >$LOGNAME.p 2>&1

References