]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
script.1: Improve documentation of non-interactive behavior
authorStanislav Brabec <sbrabec@suse.cz>
Fri, 13 Feb 2015 18:59:22 +0000 (19:59 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 16 Feb 2015 09:49:36 +0000 (10:49 +0100)
- use exit in .profile to avoid non-logged session after typing "exit"
- document that script can read more from stdin than the command inside:

echo -e 'script -c "read a b ; echo a=\$a b=\$b >defs.sh"\n1 2\necho Done' | sh
Script started, file is typescript
1 2
echo Done
Script done, file is typescript

term-utils/script.1

index e130c77d900da48e6bfb2155e024ad816adaac95..6b566fe5edceef21ed06f2120400916a63df6834 100644 (file)
@@ -128,7 +128,8 @@ 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.
+in the shell initialization file, you have to avoid entering an infinite
+loop. Use e. g. profile file, which is read by login shells only:
 .RS
 .RE
 .sp
@@ -137,10 +138,15 @@ in the shell initialization file (profile), you should use e. g.
 .nf
 if test -t 0 ; then
     script
+    exit
 fi
 .fi
 .RE
 .PP
+You should also avoid use of script in command pipes, as
+.B script
+can read more input than you would expect.
+.PP
 .SH ENVIRONMENT
 The following environment variable is utilized by
 .BR script :