What is /usr/bin/[?

Solution 1:

It's an alternative form of the 'test' command. Mostly used in scripts.

i.e.

if [ $VAR ]
then
    echo $VAR exists!
fi

Solution 2:

It's what you call when you are using something like

if [ -e foo ]; then ...

in a shell script (but most shells have it as a buildin this days). man test should give you the docs.


Solution 3:

As others pointed out, [ is the shell's condition evaluation utility - test.

In fact, there is a manual page for that!

$ man [

should give you more details about the opening square bracket.

Btw, in OS X, [ is located in /bin/[ :)