.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\" SUCH DAMAGE.
.\"
.\" @(#)script.1 8.1 (Berkeley) 6/6/93
-.\" $FreeBSD: src/usr.bin/script/script.1,v 1.21 2004/07/03 00:24:43 ru Exp $
+.\" $FreeBSD$
.\"
-.Dd January 22, 2004
+.Dd December 4, 2013
.Dt SCRIPT 1
.Os
.Sh NAME
.Nd make typescript of terminal session
.Sh SYNOPSIS
.Nm
-.Op Fl akq
+.Op Fl adkpqr
+.Op Fl F Ar pipe
.Op Fl t Ar time
.Op Ar file Op Ar command ...
.Sh DESCRIPTION
or
.Pa typescript ,
retaining the prior contents.
+.It Fl d
+When playing back a session with the
+.Fl p
+flag, do not sleep between records when playing back a timestamped session.
+.It Fl F Ar pipe
+Immediately flush output after each write.
+This will allow a user to create a named pipe using
+.Xr mkfifo 1
+and another user may watch the live session using a utility like
+.Xr cat 1 .
+.\".It Fl f
+.\"Create
+.\".Ar file.filemon
+.\"or
+.\".Pa typescript.filemon
+.\"using
+.\".Xr filemon 4 .
.It Fl k
-Log keys sent to program as well as output.
+Log keys sent to the program as well as output.
+.It Fl p
+Play back a session recorded with the
+.Fl r
+flag in real time.
.It Fl q
-Run in quiet mode, omit the start and stop status messages.
+Run in quiet mode, omit the start, stop and command status messages.
+.It Fl r
+Record a session with input, output, and timestamping.
.It Fl t Ar time
-Specify time interval between flushing script output file.
+Specify the interval at which the script output file will be flushed
+to disk, in seconds.
A value of 0
causes
.Nm
-to flush for every character I/O event.
+to flush after every character I/O event.
The default interval is
30 seconds.
.El
utility works best with commands that do not manipulate the screen.
The results are meant to emulate a hardcopy terminal, not an addressable one.
.Sh ENVIRONMENT
-The following environment variable is utilized by
+The following environment variables are utilized by
.Nm :
.Bl -tag -width SHELL
+.It Ev SCRIPT
+The
+.Ev SCRIPT
+environment variable is added to the sub-shell.
+If
+.Ev SCRIPT
+already existed in the users environment,
+its value is overwritten within the sub-shell.
+The value of
+.Ev SCRIPT
+is the name of the
+.Ar typescript
+file.
.It Ev SHELL
If the variable
.Ev SHELL
.Ev SHELL
is not set, the Bourne shell
is assumed.
-(Most shells set this variable automatically).
+.Pq Most shells set this variable automatically .
.El
.Sh SEE ALSO
.Xr csh 1
-(for the
-.Em history
-mechanism).
+.\".Xr filemon 4
+.\".Po
+.\"for the
+.\".Em history
+.\"mechanism
+.\".Pc .
.Sh HISTORY
The
.Nm
command appeared in
.Bx 3.0 .
+.Pp
+The
+.Fl d ,
+.Fl p
+and
+.Fl r
+options first appeared in
+.Nx 2.0
+and were ported to
+.Fx 9.2 .
.Sh BUGS
The
.Nm
The slave terminal mode is checked
for ECHO mode to check when to avoid manual echo logging.
This does not
-work when in a raw mode where the program being run is doing manual echo.
+work when the terminal is in a raw mode where
+the program being run is doing manual echo.
+.Pp
+If
+.Nm
+reads zero bytes from the terminal, it switches to a mode when it
+only attempts to read
+once a second until there is data to read.
+This prevents
+.Nm
+from spinning on zero-byte reads, but might cause a 1-second delay in
+processing of user input.