From: Stanislav Brabec <sbrabec@suse.cz>
To: util-linux@vger.kernel.org
Subject: [PATCH] script.1: Improve documentation of non-interactive behavior
Date: Fri, 13 Feb 2015 19:59:22 +0100 [thread overview]
Message-ID: <54DE498A.80604@suse.cz> (raw)
- 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
reply other threads:[~2015-02-13 18:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54DE498A.80604@suse.cz \
--to=sbrabec@suse.cz \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.