'app --help' should go to stdout or stderr? 'app --help' should go to stdout or stderr? shell shell

'app --help' should go to stdout or stderr?


Only errors go to stderr. This is in no way an error, it does exactly what the user had in mind, which is print usage information.


Always stdout, makes it easier to pipe to less, grep it etc.

If you are showing the help text because there was a problem with parsing the command line arguments, then you might use stderr.


Well, it's an explicit request for help so it's output. If for some reason you can't output the help or the user mis-spells "help" then, by all means, send that to error :-)

Users that know what they're doing can use the infamous "2>&1" if they want errors on standard output.