266 lines
6.6 KiB
HTML
266 lines
6.6 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of SCRIPT</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>SCRIPT</H1>
|
|
Section: User Commands (1)<BR>Updated: June 2014<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
script - make typescript of terminal session
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>script</B>
|
|
|
|
[options]
|
|
[<I>file</I>]
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>script</B>
|
|
|
|
makes a typescript of everything displayed on your terminal. It is useful for
|
|
students who need a hardcopy record of an interactive session as proof of an
|
|
assignment, as the typescript file can be printed out later with
|
|
<B><A HREF="/cgi-bin/man/man2html?1+lpr">lpr</A></B>(1).
|
|
|
|
<P>
|
|
|
|
If the argument
|
|
<I>file</I>
|
|
|
|
is given,
|
|
<B>script</B>
|
|
|
|
saves the dialogue in this
|
|
<I>file</I>.
|
|
|
|
If no filename is given, the dialogue is saved in the file
|
|
<B>typescript</B>.
|
|
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
Below, the <I>size</I> argument may be followed by the multiplicative
|
|
suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB
|
|
(the "iB" is optional, e.g. "K" has the same meaning as "KiB"), or the suffixes
|
|
KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB.
|
|
<DL COMPACT>
|
|
<DT id="1"><B>-a</B>, <B>--append</B><DD>
|
|
Append the output to
|
|
<I>file</I>
|
|
|
|
or to
|
|
<B>typescript</B>,
|
|
|
|
retaining the prior contents.
|
|
<DT id="2"><B>-c</B>, <B>--command</B> <I>command</I><DD>
|
|
Run the
|
|
<I>command</I>
|
|
|
|
rather than an interactive shell. This makes it easy for a script to capture
|
|
the output of a program that behaves differently when its stdout is not a
|
|
tty.
|
|
<DT id="3"><B>-e</B>, <B>--return</B><DD>
|
|
Return the exit code of the child process. Uses the same format as bash
|
|
termination on signal termination exit code is 128+n. The exit code of
|
|
the child process is always stored in type script file too.
|
|
<DT id="4"><B>-f</B>, <B>--flush</B><DD>
|
|
Flush output after each write. This is nice for telecooperation: one person
|
|
does `mkfifo foo; script -f foo', and another can supervise real-time what is
|
|
being done using `cat foo'.
|
|
<DT id="5"><B>--force</B><DD>
|
|
Allow the default output destination, i.e. the typescript file, to be a hard
|
|
or symbolic link. The command will follow a symbolic link.
|
|
<DT id="6"><B>-o</B>, <B>--output-limit</B> <I>size</I><DD>
|
|
Limit the size of the typescript and timing files to
|
|
<I>size</I>
|
|
|
|
and stop the child process after this size is exceeded. The calculated
|
|
file size does not include the start and done messages that the
|
|
<B>script</B>
|
|
|
|
command prepends and appends to the child process output.
|
|
Due to buffering, the resulting output file might be larger than the specified value.
|
|
<DT id="7"><B>-q</B>, <B>--quiet</B><DD>
|
|
Be quiet (do not write start and done messages to standard output).
|
|
<DT id="8"><B>-t</B>[<I>file</I>], <B>--timing</B>[=<I>file</I>]<DD>
|
|
Output timing data to standard error, or to
|
|
<I>file</I>
|
|
|
|
when given. This data contains two fields, separated by a space. The first
|
|
field indicates how much time elapsed since the previous output. The second
|
|
field indicates how many characters were output this time. This information
|
|
can be used to replay typescripts with realistic typing and output delays.
|
|
<DT id="9"><B>-V</B>, <B>--version</B><DD>
|
|
Display version information and exit.
|
|
<DT id="10"><B>-h</B>, <B>--help</B><DD>
|
|
Display help text and exit.
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
The script ends when the forked shell exits (a
|
|
<I>control-D</I>
|
|
|
|
for the Bourne shell
|
|
(<B><A HREF="/cgi-bin/man/man2html?1+sh">sh</A></B>(1)),
|
|
|
|
and
|
|
<I>exit</I>,
|
|
|
|
<I>logout</I>
|
|
|
|
or
|
|
<I>control-d</I>
|
|
|
|
(if
|
|
<I>ignoreeof</I>
|
|
|
|
is not set) for the
|
|
C-shell,
|
|
<B><A HREF="/cgi-bin/man/man2html?1+csh">csh</A></B>(1)).
|
|
|
|
<P>
|
|
|
|
Certain interactive commands, such as
|
|
<B><A HREF="/cgi-bin/man/man2html?1+vi">vi</A></B>(1),
|
|
|
|
create garbage in the typescript file.
|
|
<B>script</B>
|
|
|
|
works best with commands that do not manipulate the screen, the results are
|
|
meant to emulate a hardcopy terminal.
|
|
<P>
|
|
|
|
It is not recommended to run
|
|
<B>script</B>
|
|
|
|
in non-interactive shells. The inner shell of
|
|
<B>script</B>
|
|
|
|
is always interactive, and this could lead to unexpected results. If you use
|
|
<B>script</B>
|
|
|
|
in the shell initialization file, you have to avoid entering an infinite
|
|
loop. You can use for example the <B>.profile</B> file, which is read
|
|
by login shells only:
|
|
<DL COMPACT><DT id="11"><DD>
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
<DL COMPACT><DT id="12"><DD>
|
|
<PRE>
|
|
if test -t 0 ; then
|
|
script
|
|
exit
|
|
fi
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
<P>
|
|
|
|
You should also avoid use of script in command pipes, as
|
|
<B>script</B>
|
|
|
|
can read more input than you would expect.
|
|
<P>
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>ENVIRONMENT</H2>
|
|
|
|
The following environment variable is utilized by
|
|
<B>script</B>:
|
|
|
|
<DL COMPACT>
|
|
<DT id="13"><B>SHELL</B>
|
|
|
|
<DD>
|
|
If the variable
|
|
<B>SHELL</B>
|
|
|
|
exists, the shell forked by
|
|
<B>script</B>
|
|
|
|
will be that shell. If
|
|
<B>SHELL</B>
|
|
|
|
is not set, the Bourne shell is assumed. (Most shells set this variable
|
|
automatically).
|
|
</DL>
|
|
<A NAME="lbAH"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+csh">csh</A></B>(1)
|
|
|
|
(for the
|
|
<I>history</I>
|
|
|
|
mechanism),
|
|
<B><A HREF="/cgi-bin/man/man2html?1+scriptreplay">scriptreplay</A></B>(1)
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H2>HISTORY</H2>
|
|
|
|
The
|
|
<B>script</B>
|
|
|
|
command appeared in 3.0BSD.
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>BUGS</H2>
|
|
|
|
<B>script</B>
|
|
|
|
places
|
|
<I>everything</I>
|
|
|
|
in the log file, including linefeeds and backspaces. This is not what the
|
|
naive user expects.
|
|
<P>
|
|
|
|
<B>script</B>
|
|
|
|
is primarily designed for interactive terminal sessions. When stdin
|
|
is not a terminal (for example: <B>echo foo | script</B>), then the session
|
|
can hang, because the interactive shell within the script session misses EOF and
|
|
<B>script</B>
|
|
|
|
has no clue when to close the session. See the <B>NOTES</B> section for more information.
|
|
<A NAME="lbAK"> </A>
|
|
<H2>AVAILABILITY</H2>
|
|
|
|
The script command is part of the util-linux package and is available from
|
|
|
|
Linux Kernel Archive
|
|
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="14"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="15"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="16"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="17"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DT id="18"><A HREF="#lbAF">NOTES</A><DD>
|
|
<DT id="19"><A HREF="#lbAG">ENVIRONMENT</A><DD>
|
|
<DT id="20"><A HREF="#lbAH">SEE ALSO</A><DD>
|
|
<DT id="21"><A HREF="#lbAI">HISTORY</A><DD>
|
|
<DT id="22"><A HREF="#lbAJ">BUGS</A><DD>
|
|
<DT id="23"><A HREF="#lbAK">AVAILABILITY</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:26 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|