Unusual file: /bin/[

RW rwmaillists at googlemail.com
Mon Jul 29 14:07:31 UTC 2013


On Mon, 29 Jul 2013 14:25:08 +0100
Paul Macdonald wrote:

> 
> Hi, I spotted what i'd call an unusual file in the basejail on a jail 
> install, and have since seen this on other non jailed boxes.
> 
> -r-xr-xr-x   2 root  wheel   11488 Jun 10 12:19 [
> 
> man [  reveals
> 
>          test, [ -- condition evaluation utility
> 
> just checking thats all ok, and i've not been rooted!

The idea was to make shell scripts more readable as you can have
something like: 

   if [ ${x} -gt 1 ] ...

[ is a hard-link to /bin/test and the closing] "]" is its last argument.

In most modern  shells its a builtin feature and /bin/[ isn't used.  


More information about the freebsd-questions mailing list