* [PATCH] script.1: Improve documentation of non-interactive behavior
@ 2015-02-13 18:59 Stanislav Brabec
0 siblings, 0 replies; only message in thread
From: Stanislav Brabec @ 2015-02-13 18:59 UTC (permalink / raw)
To: util-linux
- 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(-)
diff --git a/term-utils/script.1 b/term-utils/script.1
index e130c77..6b566fe 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 :
--
2.2.2
--
Best Regards / S pozdravem,
Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o. e-mail: sbrabec@suse.cz
Lihovarská 1060/12 tel: +49 911 7405384547
190 00 Praha 9 fax: +420 284 084 001
Czech Republic http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-02-13 18:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-13 18:59 [PATCH] script.1: Improve documentation of non-interactive behavior Stanislav Brabec
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.