logoalt Hacker News

anyfooyesterday at 11:03 PM4 repliesview on HN

Disagree. stdout is only reserved for actual processed command output. It may be empty, it may be invalid because the input was invalid (shit in, shit out), but it may never be things intended for a human to read.

If one wants to use a pager (like I sometimes do, though most of the time I just scroll up), they'll just use `foo 2>&1 | less`.


Replies

archargelodtoday at 11:17 AM

> stdout is only reserved for actual processed command output

If user asks a program to print help message, the help text is the processed command output!

ryandrakeyesterday at 11:16 PM

GNU offers guidance[1] to output --help to stdout, but it's not against the law to do it your way.

1: https://www.gnu.org/prep/standards/html_node/_002d_002dhelp....

show 1 reply
ramses0today at 2:00 AM

In the case of `git log -100 | grep FOO`, the log output should go to stdout.

In the case of `git diff | grep FOO`, the diff output should go to stdout.

In the case of `git --help | grep FOO` the help output should go to stdout.

In the case of `git --omg-wtf | grep FOO`, it's fine if there is only output on stderr.

tardedmemeyesterday at 11:40 PM

I see you've never tried to run command --help | less

show 2 replies