What is the /bin/[ '[' file in OS X?

Enter image description here

See the screen shot.

There is the '[' file at /bin.

What is the '[' file? What does it do?


Solution 1:

This command is for comparing values, checking file types etc.

Here's a man page:

NAME
 test, [ -- condition evaluation utility

SYNOPSIS
 test expression
 [ expression ]

It's usually used like this:

if [ -f /etc/passwd ] 
then
   echo "Yes"
else
   echo "No"  
fi

For more info, please read the man page ( man [ ).