Name

[[ ]] — Extended version of the test command.

Synopsis

[[ expression ]]

Same as test expression or [ expression ], except that [[ ]] allows additional operators. Word splitting and filename expansion are disabled. Note that the brackets ([ ]) are typed literally, and that they must be surrounded by whitespace. See test.

Additional Operators

&&

Logical AND of test expressions (short circuit).

||

Logical OR of test expressions (short circuit).

<

First string is lexically “less than” the second, based on the locale’s sorting order. (However, see the description of the compat31, compat32, and compat40 options in the section Shell Options.)

>

First string is lexically “greater than” the second, based on the locale’s sorting order. (However, see the description of the compat31, compat32, and compat40 options in the section Shell Options.)

Get bash Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.