From: Stephen Hemminger > Sent: 08 August 2016 16:57 > To: Jiri Pirko ... > > >> In order to not confuse reader, write help messages into stderr. > > >> > > >> Signed-off-by: Jiri Pirko <j...@mellanox.com> > > > > > >This does make devlink consistent with other parts of iproute2. > > >But the most common coding standards, back to Unix, and GNU are > > >that help messages should go to stdout so that: > > > $ ip -h | more > > >would work as expected. > > > > The thing is I wanted to make stdout only for json. Putting non-json > > help out there does not look correct to me. Is it? > > > > I applied both of these patches, just wanted to mention that iproute2 is not > following the GNU convention. At this point, it really doesn't matter, there > are arguments to be made for both behaviors.
If you output help in response to an invalid option (eg) 'ip -?' then you need to write it to stderr since it is part of the error message. OTOH if help is explicitly requested 'ip -h' then stdout would be ok. Nothing wrong with typing 'ip -h 2>&1 | pg' though. David