1.\" $NetBSD: script.1,v 1.13 2011/06/08 13:54:16 yamt Exp $ 2.\" 3.\" Copyright (c) 1980, 1990, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" @(#)script.1 8.1 (Berkeley) 6/6/93 31.\" 32.Dd October 17, 2009 33.Dt SCRIPT 1 34.Os 35.Sh NAME 36.Nm script 37.Nd make typescript of terminal session 38.Sh SYNOPSIS 39.Nm 40.Op Fl adfpqr 41.Op Fl c Ar command 42.Op Ar file 43.Sh DESCRIPTION 44.Nm 45makes a typescript of everything printed on your terminal. 46It is useful for students who need a hardcopy record of an interactive 47session as proof of an assignment, as the typescript file 48can be printed out later with 49.Xr lpr 1 . 50.Pp 51If the argument 52.Ar file 53is given, 54.Nm 55saves all dialogue in 56.Ar file . 57If no file name is given, the typescript is saved in the file 58.Pa typescript . 59.Pp 60Option: 61.Bl -tag -width Ds 62.It Fl a 63Append the output to 64.Ar file 65or 66.Pa typescript , 67retaining the prior contents. 68.It Fl c Ar command 69Run the named 70.Ar command 71instead of the shell. 72Useful for capturing the output of a program that behaves differently when 73associated with a tty. 74.It Fl d 75When playing back a session with the 76.Fl p 77flag, don't sleep between records when playing back a timestamped session. 78.It Fl f 79Flush output after each write. 80This is useful for watching the script output in real time. 81.It Fl p 82Play back a session recorded with the 83.Fl r 84flag in real time. 85.It Fl q 86Be quiet, and don't output started and ended lines. 87.It Fl r 88Record a session with input, output, and timestamping. 89.El 90.Pp 91The script ends when the forked shell exits (a 92.Em control-D 93to exit 94the Bourne shell 95.Pf ( Xr sh 1 ) , 96and 97.Em exit , 98.Em logout 99or 100.Em control-d 101(if 102.Em ignoreeof 103is not set) for the 104C-shell, 105.Xr csh 1 ) . 106.Pp 107Certain interactive commands, such as 108.Xr vi 1 , 109create garbage in the typescript file. 110.Nm 111works best with commands that do not manipulate the 112screen, the results are meant to emulate a hardcopy 113terminal. 114.Sh ENVIRONMENT 115The following environment variable is used by 116.Nm : 117.Bl -tag -width SHELL 118.It Ev SHELL 119If the variable 120.Ev SHELL 121exists, the shell forked by 122.Nm 123will be that shell. 124If 125.Ev SHELL 126is not set, the Bourne shell 127is assumed. 128(Most shells set this variable automatically). 129.El 130.Sh SEE ALSO 131.Xr csh 1 132(for the 133.Em history 134mechanism). 135.Sh HISTORY 136The 137.Nm 138command appeared in 139.Bx 3.0 . 140.Sh BUGS 141.Nm 142places 143.Sy everything 144in the log file, including linefeeds and backspaces. 145This is not what the naive user expects. 146