SCRIPT(1) BSD Reference Manual SCRIPT(1)
script - make typescript of terminal session
script [-alqsU] [-c cmd] [-L|U replstr] [-n | file]
script opens a pseudo-tty master and starts an interactive shell which is connected to the slave tty. If the -n option is not given, it makes a typescript of everything printed on your terminal. It is useful for stu- dents who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1). It is also useful for people who log in to a MirBSD box with a terminal that is not UTF-8 capable, or to connect to a non-UTF-8-capable box. If the argument file is given, script saves all dialogue in file. If no file name is given, the typescript is saved in the file typescript. The options are as follows: -a Append the output to file or typescript, retaining the prior con- tents. -c cmd Instead of running ${SHELL:-/bin/sh} -i, execute ${SHELL:-/bin/sh} -c 'cmd'. -L replstr Assume the terminal uses ISO-8859-1 ("latin1") encoding, and con- vert from and to UTF-8 for the pty. Inconvertible characters are displayed as replstr, one per column. -l Assume the terminal uses ISO-8859-1 ("latin1") encoding, and con- vert from and to UTF-8 for the pty. Inconvertible characters are displayed as one question mark per column. -n Do not record a typescript. -q Be quiet. -s Start a login shell. -U replstr Assume the session uses ISO-8859-1 ("latin1") encoding, and con- vert from and to UTF-8 for the pty. Inconvertible characters are sent to the inside shell as replstr, one per column. -u Assume the session uses ISO-8859-1 ("latin1") encoding, and con- vert from and to UTF-8 for the pty. Inconvertible characters are sent to the inside shell as one question mark per column. The script ends when the forked shell exits (a control-D ('^D') to exit the Bourne shell (sh(1)), and exit, logout, or control-D (if ignoreeof is not set) for the C-shell, csh(1)). script will exit with the status of 0 unless any of its child processes fail. In which case, script will return 1. Certain interactive commands, such as vi(1), create garbage in the typescript file. script works best with commands that do not manipulate the screen; the results are meant to emulate a hardcopy terminal.
SHELL Name of the shell to be forked by script. If not set, the Bourne shell is assumed. (Most shells set this variable automatically.)
$ script Records a typescript of an interactive session. $ script -ln Runs a UTF-8 session inside an ISO-8859-1 hardware terminal. /usr/ports/misc/screen can do even more, but is not part of MirBSD. $ luit -encoding 'ISO 8859-1' -- ssh remote Run inside the UTF-8 session, connects to a remote system which uses ISO- 8859-1 encoding and ISO 2022 shift sequences. $ script -unc ssh remote This is the same, without luit. ISO-8859-1 for the inside is hard-coded.
luit(1), screen(1)
The script command appeared in 3.0BSD. Support for recoding between la- tin1 and utf-8 appeared in MirBSD #10.
The recoding, execute shell command code, and codeset support was au- thored by Thorsten Glaser <tg@mirbsd.de>.
script places everything in the log file, including linefeeds and back- spaces. This is not what the naive user expects. While double-width characters are presented as two times the replstr, combining characters are hidden. xterm(1) does some sort of precomposing and then displays them together as single character, or, as replacement if it stands - cf. /usr/src/contrib/samples/utf-8 - alone. script just doesn't display them at all. GNU screen has a different, also slightly broken, logic and has even worse width behaviour in that file, but re- places unicode line-drawing characters with their ACS equivalents. MirBSD #10-current September 6, 2009 1