3 ms·
Let's take the cut command for instance. If you read the man page you discover it's job is to parse fields out of each line of input. Printing a usage message
by dingosity 3y ago
Let's take the cut command for instance. If you read the man page you discover it's job is to parse fields out of each line of input. Printing a usage message into STDOUT is not part of its documented behaviour. It is therefore an exceptional event.
- rahimnathwani 3y agocut does the right thing: - if you run cut with no input and no parameters, it outputs an error message to STDERR - if you run cut --help it outputs usage info to STDOUT This is what I'd expect based on the man page. Running cut with no parameters is undefined, hence the output to STDERR. Running cut --help is defined, so the output goes to STDERR. I think people get confused because some tools, when run without any input, output the full help info to STDERR, instead of suggesting the user run foo --help*. So foo* and foo --help* appear to be equivalent. Until you pipe into less*.