3

I'm trying to find the man page for [[ (double-brackets).

Apparently man test only documents test and [.

Are the conditionals for [[ and [ are exactly the same?

2 Answers2

6

Since [[ is part of the bash grammar and [ is a command built into the shell, both are documented in the bash manual itself.

[[ is documented under SHELL GRAMMAR/Compound Commands and also under CONDITIONAL EXPRESSIONS (as is [), and [ is further documented together with the test built in command under SHELL BUILTIN COMMANDS.

The test manual that you read with man test documents the external test and [ commands, probably available as /usr/bin/test and /usr/bin/[ (or possibly under /bin depending on what Unix you use).

Related:

Kusalananda
  • 333,661
  • In the manual, easiest would be to use the index. In info, use i, in HTML, see there. In PS/PDF printout, see at the end of the book. Don't use man for a manual of this size, there's a reason why it's called a man page. – Stéphane Chazelas Sep 05 '18 at 22:14
3
  1. Also useful is the help builtin. This will print 22 lines of info about [[:

    help [[
    
  2. The [ and [[ are significantly different. See What's the difference between [ and [[ in Bash?
agc
  • 7,223