2

I just did man [ and it opened the manual.

Then I tried doing man > but I get this error:

-bash: syntax error near unexpected token `newline'

How is > different from [?

6
  • 3
    Altough [ or test is a builtin it also exists as a separate command (/bin/[). > is a redirection operator and is part of a shell implementation (does not exist as a separate command). Info about redirection operators can be consulted from the shell man page (e.g, bash, zsh, ksh, etc.). – Paulo Tomé Mar 30 '20 at 18:08
  • I see. so how do I pull up documentation on > from with my terminal/command line? – Honey Mar 30 '20 at 18:09
  • 2
  • 1
    [ (or its alias test) has two implementations; it exists as a shell builtin and as a separate command. Whereas the redirection operators only exist as a builtin command. – Paulo Tomé Mar 30 '20 at 18:22
  • 1
    Shell builtins do not have their own individual man pages l. They're documented in the respective shell man page. – Paulo Tomé Mar 30 '20 at 18:32
1

As you have seen, the command man > will invoke redirection rather than give you a man page for it.

Since > is a shell operator, you need to go to the man page for your shell, for example if you run bash you can use man bash and look for the section on 'REDIRECTION'. All the shell redirection operators will be listed there; they don't have their own man pages.

2
  • I hit cmmd + f and searched for REDIRECTION but wasn't able to find it. The search only worked if REDIRECTION was visible. Is that also happening for you? Is that expected or that's a bug? – Honey Mar 30 '20 at 19:07
  • My MANPAGER is less so I use forward slash / which will accept regex. For many distros this is the default MANPAGER but you can change it if you like. – user1794469 Mar 30 '20 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.