[TUHS] Why does shell write to stderr?

George Michaelson ggm at algebras.org
Fri Apr 8 08:30:01 AEST 2022


I also had extreme WTF the first time I looked in code and saw an
isatty() guard over some activity.

"this program processes stdin to stdout, except.. if I decide
otherwise" never appeared in man pages.

But that said, it sort of made sense. Why ring bell in an editor, if
you know the input pipe side can't hear it? A tty is a rather strange
device being the join over stdout, stdin and stderr, and there is a
(tiny?) set of things which need to know.

more for instance, probably needs to know that waiting for a command
to move pagination onward if there is no controlling terminal is not
sensible. If you want your input in chunks, more is not the way to do
it.

I hate special cases. This is why people say english is so hard to
learn but really all languages have them, its just that english having
stolen words from everywhere has more instances of isatty() than
others.

-G


More information about the TUHS mailing list