diff options
author | Stanislav Brabec <sbrabec@suse.cz> | 2015-02-13 19:59:22 +0100 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2015-02-16 10:49:36 +0100 |
commit | ab52a8bcce2f01bb44d3c2266e19b32e9639084b (patch) | |
tree | f938f29a44c2d494dd4d01f2ab01849543966eab | |
parent | 8fd4a7aa81d2bd65dd586a6c0de989d1abdae8a4 (diff) | |
download | util-linux-playground-ab52a8bcce2f01bb44d3c2266e19b32e9639084b.tar.gz |
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
-rw-r--r-- | term-utils/script.1 | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/term-utils/script.1 b/term-utils/script.1 index e130c77d90..6b566fe5ed 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 : |