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?
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?
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:
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
Also useful is the help
builtin. This will print 22 lines of
info about [[
:
help [[
[
and [[
are significantly different. See What's the
difference between [ and [[ in Bash?
info bash '[['
– Stéphane Chazelas Sep 05 '18 at 21:55