Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I don't know why, but piping cvs --help to less doesn't work. Probably it's because cvs --help outputs not to standard output(1) or error output(2), but somewhere else. Could you tell me where does it output?

share|improve this question
add comment

1 Answer

The reason is because there's two types of output.

  • Normal output (STDOUT)
  • Error output (STDERR)

cvs --help prints the help info to STDERR. The pipe (|) is expecting data that was written to STDOUT so that it can be read STDIN.

In order to get the help text from STDERR to STDOUT (so that it's readable by the pipe) you need to redirect it.

cvs --help 2>&1 | less

Further explanation here.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.