<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Script_%28Unix%29</id>
	<title>Script (Unix) - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=Script_%28Unix%29"/>
	<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Script_(Unix)&amp;action=history"/>
	<updated>2026-10-26T03:48:20Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://debianws.lexgopc.com/wiki143/index.php?title=Script_(Unix)&amp;diff=7716403&amp;oldid=prev</id>
		<title>imported&gt;WikiCleanerBot: v2.05b - Bot T19 CW#25 - Fix errors for CW project (Heading hierarchy)</title>
		<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=Script_(Unix)&amp;diff=7716403&amp;oldid=prev"/>
		<updated>2025-02-19T04:10:44Z</updated>

		<summary type="html">&lt;p&gt;v2.05b - &lt;a href=&quot;/wiki143/index.php?title=User:WikiCleanerBot&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User:WikiCleanerBot (page does not exist)&quot;&gt;Bot T19 CW#25&lt;/a&gt; - Fix errors for &lt;a href=&quot;/wiki143/index.php?title=WP:WCW&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;WP:WCW (page does not exist)&quot;&gt;CW project&lt;/a&gt; (Heading hierarchy)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Short description|Unix command}}&lt;br /&gt;
{{lowercase}}&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;script&amp;#039;&amp;#039;&amp;#039; command is a [[Unix utility]] that records a [[computer terminal|terminal]] session. It dates back to the 1979 3.0 [[Berkeley Software Distribution]] (BSD).&amp;lt;ref name=&amp;quot;man&amp;quot;&amp;gt;{{man|1|script|FreeBSD}}&amp;lt;/ref&amp;gt; &lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
A script session is captured in file name {{code|typescript}} by default; to specify a different filename follow the {{code|script}} command with a space and the filename as such: {{code|script recorded_session}}.&lt;br /&gt;
&lt;br /&gt;
The recorded format of {{code|script}} consists of plain-text timing information (for the whole session) and verbatim command output, including whatever [[ANSI escape code]] the program has printed for formatting. It uses a [[pseudoterminal]] for this purpose, so programs act exactly as if they were on a terminal.&amp;lt;ref name=&amp;quot;man&amp;quot; /&amp;gt; The [[util-linux]] {{code|scriptreplay}} command offers a replay function to its script, which supports using an extra timing file for character-level information.&amp;lt;ref&amp;gt;{{man|1|scriptreplay|Linux}}&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;[http://www.linuxinsight.com/replaying-terminal-sessions-with-scriptreplay.html LinuxInsight - Replaying terminal sessions with scriptreplay]&amp;lt;/ref&amp;gt; Some online services, such as the now-defunct shelr.tv, can also show the format as a low-bandwidth alternative to video screencasts.&amp;lt;ref&amp;gt;[http://www.omgubuntu.co.uk/2012/04/how-to-record-and-share-terminal-screencasts-quickly/ OMG! Ubuntu! - How To Record And Share Terminal Screencasts Quickly]&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problems with script command ==&lt;br /&gt;
One of the problems with the script command is that it only allows logging of a child process; and often there is a need to log the command in the current process without spawning a new process, such as when automation of a script is needed that can log its own output.  The [[Unix]] operating systems make this possible by use of [[Pipe (Unix)|pipe]]s and redirects. Consider the following model examples:&lt;br /&gt;
&lt;br /&gt;
=== Bourne shell ===&lt;br /&gt;
&lt;br /&gt;
All [[Unix shell|shells]] related to [[Bourne shell]] (&amp;lt;code&amp;gt;sh&amp;lt;/code&amp;gt;), for example [[Thompson shell]] (&amp;lt;code&amp;gt;sh&amp;lt;/code&amp;gt;), [[Bash (Unix shell)|Bash]] (&amp;lt;code&amp;gt;bash&amp;lt;/code&amp;gt;), [[KornShell]] (&amp;lt;code&amp;gt;ksh&amp;lt;/code&amp;gt;), and [[Z shell]] (&amp;lt;code&amp;gt;zsh&amp;lt;/code&amp;gt;), allow the [[stdout]] and [[stderr]] to be attached to a [[named pipe]] and redirected to the [[tee (command)|tee command]], for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
LOGNAME=&amp;quot;script&amp;quot;&lt;br /&gt;
rm -f $LOGNAME.p $LOGNAME.log&lt;br /&gt;
mknod $LOGNAME.p p &lt;br /&gt;
tee  &amp;lt;$LOGNAME.p $LOGNAME.log &amp;amp;&lt;br /&gt;
exec &amp;gt;$LOGNAME.p 2&amp;gt;&amp;amp;1&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above script records to {{code|script.log}} all output of the {{code|exec}} command.  However, some interactive programs (such as [[Python (programming language)|Python]]) do not echo their standard input when run under the resulting shell, although they do when run under the script command, again due to the detection of a terminal.&lt;br /&gt;
&lt;br /&gt;
== Alternatives to script command==&lt;br /&gt;
The [[ttyrec]] program from 2000 provides the same kind of functionality and offers several bindings. The timing is similar to util-linux. A more modern take on the concept is &amp;quot;asciicast&amp;quot; [[JSON]], used by asciinema.&amp;lt;ref&amp;gt;{{Cite web|url=https://asciinema.org/about|title=About - asciinema}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Command line interpreter]]&lt;br /&gt;
* [[Shebang (Unix)]]&lt;br /&gt;
* [[C shell]]&lt;br /&gt;
* [[Filename extension]]&lt;br /&gt;
* [[Perl]]&lt;br /&gt;
* [[Scripting language]]&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{Reflist}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Unix software]]&lt;/div&gt;</summary>
		<author><name>imported&gt;WikiCleanerBot</name></author>
	</entry>
</feed>