Advanced tests using [[

The use of the double brackets [[ condition ]] allows us to do more advanced condition testing but it is not compatible with the Bourne shell. The double brackets were first introduced as a defined keyword in the KornShell and are also available in bash and Zsh. Unlike the single bracket, this is not a command but a keyword. The use of the type command can confirm this:

$ type [[

Get Mastering Linux Shell Scripting 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.