Skip to content

script: no logging for non-interactive shells

Stanislav Brabec util-linux 1 version Applied

Status from this message: Applied, thanks :-)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 3 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/3script: Split doexec() out of doshell()term-utils/script.c+26 -200 replies
2/3script: Initialize isterm and shell earlier in main()term-utils/script.c+6 -60 replies
3/3script: Introduce --interactive command line optionterm-utils/script.1 term-utils/script.c+20 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] script: no logging for non-interactive shells

Many people use script in their shell initialization files. It has some unwanted consequences, e. g. logging commands from cron (and starting them in a pseudo-terminal and interactive shell). It could also result in a seemingly hanging applications:

For example:

echo -e './script\nTERM=linux mutt' | \
at $(date -d "+1 minute 5 seconds" +%H:%M)

mutt will "hang" inside at, because it thinks that it is running in an interactive shell and waits for input.

That is why I wrote --interactive command line option. If it is set, script called from a non-interactive session will not log anything, just (optionally) execute -c argument and silently exit.

Note that similar behavior existed between f50473e and 3822032, but the new proposed behavior does not generate error.

Signature · 10 lines
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: [email protected]
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