Thanks Max, On 15/02/24 at 03:28, Max Nikulin wrote:
# env LC_ALL=C script -t 2>~/upgrade-bookwormstep.time -a ~/upgrade-bookwormstep.scriptPerhaps LC_ALL=C.UTF-8 is safer. At least several years ago some python scripts (unrelated to Debian upgrade however) failed trying to log e.g. non-ascii file paths, etc.I would reset LANGUAGE as well otherwise some programs may use localized messages.Finally, some users might have LC_ALL (despite it is not recommended) or LANGUAGE set in a file like ~/.bashrc. That is why the following approach may be more reliable. Run commands within the "script" sessionLANG=C.UTF-8; LANGUAGE=; export LANG LANGUAGEwith a note concerning csh. To affect messages generated by shell itself, "export" is separated from setting of the variables.
Doesn't LC_ALL=C setting override LANG or LANGUAGE settings? On my system I have:
~$ env | grep LANG LANGUAGE= LANG=it_IT.UTF-8and LC_ALL=C override the LANG setting when used inline of the command. This approach is to cover all cases, my goal is to do apt/apt-get commands output in English when they are executed into a "script" session. Thank to Greg's contribute I think I've reached it:
On 14/02/24 at 21:55, Greg Wooledge wrote:The man page says: -t[file], --timing[=file] Output timing data to standard error, or to file when given. This option is deprecated in favour of --log-timing where the file argument is not optional. And: -T, --log-timing file Log timing information to the file. Two timing file formats are supported now. The classic format is used when only one stream (input or output) logging is enabled. The multi-stream format is used on --log-io or when --log-in and --log-out are used together. See also --logging-format. One of these paragraphs should give a solution that avoids needing 2>.
The following "script" command syntax should work on all shells (tested only in Bash):
# env LC_ALL=C script -T ~/upgrade-bookwormstep.time -a ~/upgrade-bookwormstep.script
-- Franco Martelli