- 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
.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
.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 :