Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jul 2013 15:07:27 +0100
From:      RW <rwmaillists@googlemail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Unusual file:  /bin/[
Message-ID:  <20130729150727.121517d2@gumby.homeunix.com>
In-Reply-To: <51F66D34.8010803@ifdnrg.com>
References:  <51F66D34.8010803@ifdnrg.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.  



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130729150727.121517d2>