ANNOTATE-OUTPUT(1)
π ANNOTATE-OUTPUT(1) π
Okay bestie, let's talk about annotate-output(1) π
It's a manual page for a tool that is literally iconic at one job: it stamps your program's output with a time and a stream label so you can see what happened and when π¦
β¨ NAME β¨
annotate-output - annotate program output with time and stream π
πΈ SYNOPSIS πΈ
annotate-output [options ...] [--] program [args ...]
π DESCRIPTION π
okay so annotate-output runs your program with its args and then glues a little prefix onto every line the program prints π§ The prefix is a time format string, then a stream indicator, then a colon and a single space.
The stream indicators are:
Ifor info coming fromannotate-outputitself πOfor STDOUT from program πEfor STDERR from program π₯
π OPTIONS π
+FORMATβ this is the format string, and it can use the conversion specifiers fromdate(1)π°οΈ The timestamp gets a single space before the stream indicator. Later options that set a format string can override it. Defaults to"%H:%M:%S"β--raw-date-format FORMATβ same vibe, samedate(1)specifiers, but there's no space between the timestamp and the stream indicator π Later format options can override this one too.--β ends option parsing π (unless it's already being used as an argument to an option, so don't get it twisted π)-h,--helpβ shows a help message π«Ά
π¦ EXIT STATUS π¦
If program actually gets invoked, annotate-output hands back program's exit status. Otherwise, it exits with one of these:
0β you used-hor--helpβ¨125β something went wrong insideannotate-outputπ126β program was found but couldn't be invoked π127β program couldn't be found, or you didn't specify one at all π
π EXAMPLE π
$ annotate-output make
21:41:21 I: Started make
21:41:21 O: gcc -Wall program.c
21:43:18 E: program.c: Couldn't compile, and took me ages to find out
21:43:19 E: collect2: ld returned 1 exit status
21:43:19 E: make: *** [all] Error 1
21:43:19 I: Finished with exitcode 2
π₯ CAVEATS AND BUGS π₯
β οΈ read this part, bestie, it's important π
Since STDOUT and STDERR are processed in parallel, some lines from STDOUT can show up before later STDERR lines, and the other way around too π This is unfortunately very hard to fix with the current annotation strategy π© A fix would mean switching to PTRACE'ing the process. Giving nice a (much) higher priority over program could make this happen less often, though π§
annotate-output expects program to output (text) lines, as specified by POSIX, to STDOUT and STDERR π It leads to undefined behaviour when lines contain NUL bytes π It may also lead to undefined behaviour when lines contain bytes that don't form valid characters in the current locale π
When an interactive program asks for input, the question might not show up until after you've already answered it π That makes it look like program has hung, but it has not, I promise π«Ά
annotate-output is implemented as a script in the Shell Command Language π Shells usually set various (shell) variables when they start, and they may set the export attribute on some of them. They also initialise (shell) variables from their own environment (as set by the caller of the shell, or the caller of annotate-output) and set the export attribute on those too.
So if the caller of annotate-output wants to set the environment (variables) of program, those variables may get overridden, or the shell may add extra ones π Also, environment variables are allowed to have names (for example .) that aren't valid shell variable names. POSIX doesn't specify whether those get exported to programs invoked from the shell, so no assumptions can be made about whether such variables will be exported correctly, or at all, to program π
π SEE ALSO π
date(1) π°οΈ
π«Ά SUPPORT π«Ά
annotate-output is community-supported, which means you'll need to fix it yourself π οΈ Patches are still very much appreciated, and so is any feedback, positive or negative π
π AUTHOR π
This manual page was written by Jeroen van Wolffelaar <jeroen@wolffelaar.nl> and can be redistributed under the terms of the GPL version 2 π The annotate-output script itself was re-written by Johannes Schauer Marin Rodrigues <josch@debian.org> and can be redistributed under the terms of the Expat license π¦
Bye bestie π«Ά that's the whole page, straight from the DEBIAN source, Debian Utilities version, ANNOTATE-OUTPUT(1) π β¨
π¦ where this page comes from
- debian trixie: devscripts 2.25.15+deb13u1 Β· GPL-2.0-or-later
- epel 10: devscripts 2.25.5-1.el10_1 Β· GPL-2.0-or-later
- epel 9: devscripts 2.25.5-1.el9 Β· GPL-2.0-or-later
- fedora 43: devscripts 2.25.19-2.fc43 Β· GPL-2.0-or-later
- fedora 43: devscripts 2.25.33-1.fc43 Β· GPL-2.0-or-later
- fedora 44: devscripts 2.26.5-1.fc44 Β· GPL-2.0-or-later
- ubuntu questing: devscripts 2.25.19ubuntu2
- ubuntu resolute: devscripts 2.26.7 Β· GPL-2.0-or-later
- ubuntu stonking: devscripts 2.26.11ubuntu1 Β· GPL-2.0-or-later
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms