From ab52a8bcce2f01bb44d3c2266e19b32e9639084b Mon Sep 17 00:00:00 2001 From: Stanislav Brabec Date: Fri, 13 Feb 2015 19:59:22 +0100 Subject: script.1: Improve documentation of non-interactive behavior - 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 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'term-utils/script.1') diff --git a/term-utils/script.1 b/term-utils/script.1 index e130c77d9..6b566fe5e 100644 --- a/term-utils/script.1 +++ b/term-utils/script.1 @@ -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 : -- cgit v1.2.3-55-g7522