]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/blob - usr.bin/script/script.1
MFH r208957: check return value from archive_read_new()
[FreeBSD/stable/8.git] / usr.bin / script / script.1
1 .\" Copyright (c) 1980, 1990, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)script.1    8.1 (Berkeley) 6/6/93
33 .\" $FreeBSD$
34 .\"
35 .Dd September 28, 2011
36 .Dt SCRIPT 1
37 .Os
38 .Sh NAME
39 .Nm script
40 .Nd make typescript of terminal session
41 .Sh SYNOPSIS
42 .Nm
43 .Op Fl akq
44 .Op Fl t Ar time
45 .Op Ar file Op Ar command ...
46 .Sh DESCRIPTION
47 The
48 .Nm
49 utility makes a typescript of everything printed on your terminal.
50 It is useful for students who need a hardcopy record of an interactive
51 session as proof of an assignment, as the typescript file
52 can be printed out later with
53 .Xr lpr 1 .
54 .Pp
55 If the argument
56 .Ar file
57 is given,
58 .Nm
59 saves all dialogue in
60 .Ar file .
61 If no file name is given, the typescript is saved in the file
62 .Pa typescript .
63 .Pp
64 If the argument
65 .Ar command
66 is given,
67 .Nm
68 will run the specified command with an optional argument vector
69 instead of an interactive shell.
70 .Pp
71 The following options are available:
72 .Bl -tag -width indent
73 .It Fl a
74 Append the output to
75 .Ar file
76 or
77 .Pa typescript ,
78 retaining the prior contents.
79 .It Fl k
80 Log keys sent to the program as well as output.
81 .It Fl q
82 Run in quiet mode, omit the start and stop status messages.
83 .It Fl t Ar time
84 Specify the interval at which the script output file will be flushed
85 to disk, in seconds.
86 A value of 0
87 causes
88 .Nm
89 to flush after every character I/O event.
90 The default interval is
91 30 seconds.
92 .El
93 .Pp
94 The script ends when the forked shell (or command) exits (a
95 .Em control-D
96 to exit
97 the Bourne shell
98 .Pf ( Xr sh 1 ) ,
99 and
100 .Em exit ,
101 .Em logout
102 or
103 .Em control-D
104 (if
105 .Em ignoreeof
106 is not set) for the
107 C-shell,
108 .Xr csh 1 ) .
109 .Pp
110 Certain interactive commands, such as
111 .Xr vi 1 ,
112 create garbage in the typescript file.
113 The
114 .Nm
115 utility works best with commands that do not manipulate the screen.
116 The results are meant to emulate a hardcopy terminal, not an addressable one.
117 .Sh ENVIRONMENT
118 The following environment variables are utilized by
119 .Nm :
120 .Bl -tag -width SHELL
121 .It Ev SCRIPT
122 The
123 .Ev SCRIPT
124 environment variable is added to the sub-shell.
125 If
126 .Ev SCRIPT
127 already existed in the users environment,
128 its value is overwritten within the sub-shell.
129 The value of
130 .Ev SCRIPT
131 is the name of the
132 .Ar typescript
133 file.
134 .It Ev SHELL
135 If the variable
136 .Ev SHELL
137 exists, the shell forked by
138 .Nm
139 will be that shell.
140 If
141 .Ev SHELL
142 is not set, the Bourne shell
143 is assumed.
144 .Pq Most shells set this variable automatically .
145 .El
146 .Sh SEE ALSO
147 .Xr csh 1
148 .Po
149 for the
150 .Em history
151 mechanism
152 .Pc .
153 .Sh HISTORY
154 The
155 .Nm
156 command appeared in
157 .Bx 3.0 .
158 .Sh BUGS
159 The
160 .Nm
161 utility places
162 .Sy everything
163 in the log file, including linefeeds and backspaces.
164 This is not what the naive user expects.
165 .Pp
166 It is not possible to specify a command without also naming the script file
167 because of argument parsing compatibility issues.
168 .Pp
169 When running in
170 .Fl k
171 mode, echo cancelling is far from ideal.
172 The slave terminal mode is checked
173 for ECHO mode to check when to avoid manual echo logging.
174 This does not
175 work when the terminal is in a raw mode where
176 the program being run is doing manual echo.
177 .Pp
178 If
179 .Nm
180 reads zero bytes from the terminal, it switches to a mode when it
181 only attempts to read
182 once a second until there is data to read.
183 This prevents
184 .Nm
185 from spinning on zero-byte reads, but might cause a 1-second delay in
186 processing of user input.