]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
script: no logging for non-interactive shells
authorStanislav Brabec <sbrabec@suse.cz>
Wed, 11 Feb 2015 14:07:52 +0000 (15:07 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 12 Feb 2015 13:31:16 +0000 (14:31 +0100)
Karel Zak wrote:

> Would be better to learn people to fix their shell initialization
> files to not call script(1) for non-interactive sessions?

It makes sense.

From 8fff32e65399ae07f70e12568d4d5278725673a7 Mon Sep 17 00:00:00 2001
From: Stanislav Brabec <sbrabec@suse.cz>
Date: Wed, 11 Feb 2015 15:02:10 +0100
Subject: [PATCH] script.1: Document behavior in non-interactive shells

And discourage users from such use.

term-utils/script.1

index 4573f07359a0c2d570fe6e7fd94d0a2a2093e427..e130c77d900da48e6bfb2155e024ad816adaac95 100644 (file)
@@ -121,6 +121,26 @@ create garbage in the typescript file.
 .B script
 works best with commands that do not manipulate the screen, the results are
 meant to emulate a hardcopy terminal.
+.PP
+It is not recommended to run
+.B script
+in non-interactive shells. The inner shell of
+.B script
+is always interactive, and this could lead to unexpected results. If you use
+.B script
+in the shell initialization file (profile), you should use e. g.
+.RS
+.RE
+.sp
+.na
+.RS
+.nf
+if test -t 0 ; then
+    script
+fi
+.fi
+.RE
+.PP
 .SH ENVIRONMENT
 The following environment variable is utilized by
 .BR script :