[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [ in /usr/bin Question



On Wed, May 09, 2007 at 03:12:20PM +0200, Joe Hart <j.hart@orange.nl> was heard to say:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Tom Grove wrote:
> > Hello all...I am new to this Debian thing :-)  I used it in the Woody
> > days but moved over to the FreeBSD world for the last few years.  I
> > recently installed Testing (Lenny) and see the left bracket in my
> > /usr/bin directory and do not know what it is.  When I ls -al it I get:
> > 
> > -rwxr-xr-x 1 root root 24752 2007-01-30 13:51 /usr/bin/[
> > 
> > This leads me to believe that it was installed with the base system or
> > some package because I just installed the system earlier this week.  Any
> > help is much appreciated.  Thanks.
> 
> I also have this file, and when I type man [, the manual for test shows
> up.  Now why this is I have no idea.  If I try the command (since it is
> executable) I get :  bash: [: missing `]'

  [ $ARGS ]

  is exactly equivalent to

    test $ARGS

  .  The closing bracket is obligatory, as shown in test(1) (unless you
pass --help or --version).  You get an error from bash instead of [
because [ is a bash builtin (equivalent to the "test" bash builtin), so
unless you run /usr/bin/[, bash will intercept the call to [ and try to
parse it itself.

  Daniel



Reply to: