xref: /netbsd-src/usr.bin/script/script.1 (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1.\"	$NetBSD: script.1,v 1.12 2009/10/17 22:28:33 wiz 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
75Don't sleep between records when playing back a timestamped session.
76.It Fl f
77Flush output after each write.
78This is useful for watching the script output in real time.
79.It Fl p
80Play back a recorded session in real time.
81.It Fl q
82Be quiet, and don't output started and ended lines.
83.It Fl r
84Record a session with input, output, and timestamping.
85.El
86.Pp
87The script ends when the forked shell exits (a
88.Em control-D
89to exit
90the Bourne shell
91.Pf ( Xr sh 1 ) ,
92and
93.Em exit ,
94.Em logout
95or
96.Em control-d
97(if
98.Em ignoreeof
99is not set) for the
100C-shell,
101.Xr csh 1 ) .
102.Pp
103Certain interactive commands, such as
104.Xr vi 1 ,
105create garbage in the typescript file.
106.Nm
107works best with commands that do not manipulate the
108screen, the results are meant to emulate a hardcopy
109terminal.
110.Sh ENVIRONMENT
111The following environment variable is used by
112.Nm :
113.Bl -tag -width SHELL
114.It Ev SHELL
115If the variable
116.Ev SHELL
117exists, the shell forked by
118.Nm
119will be that shell.
120If
121.Ev SHELL
122is not set, the Bourne shell
123is assumed.
124(Most shells set this variable automatically).
125.El
126.Sh SEE ALSO
127.Xr csh 1
128(for the
129.Em history
130mechanism).
131.Sh HISTORY
132The
133.Nm
134command appeared in
135.Bx 3.0 .
136.Sh BUGS
137.Nm
138places
139.Sy everything
140in the log file, including linefeeds and backspaces.
141This is not what the naive user expects.
142