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

Re: Strange /usr/bin file



On Mon, Feb 11, 2008 at 10:22:21AM +0100, Mirco Piccin wrote:
> Hi all.
> I find in my Debian Lenny machine this file, in /usr/bin folder:
> 
> -rwxr-xr-x  1 root   root       34504 2008-01-29 04:03 [
> 
> Who created this file? What does it do?

I presume you mean "what" created this file?

chrisb@box:~$ dpkg -S /usr/bin/[
dpkg: /usr/bin/[ not found.

Huh?

chrisb@box:~$ ls -al /usr/bin/[
-rwxr-xr-x 1 root root 24752 2007-01-31 07:51 /usr/bin/[

Ahhh OK ... ummm ... ahhh!!

chrisb@box:~$ help [
[: [ arg... ]
     This is a synonym for the "test" builtin, but the last
    argument must be a literal `]', to match the opening `['.
[[ ... ]]: [[ expression ]]
     Returns a status of 0 or 1 depending on the evaluation of the conditional
    expression EXPRESSION.  Expressions are composed of the same primaries used
    by the `test' builtin, and may be combined using the following operators
    
    	( EXPRESSION )	Returns the value of EXPRESSION
    	! EXPRESSION	True if EXPRESSION is false; else false
    	EXPR1 && EXPR2	True if both EXPR1 and EXPR2 are true; else false
    	EXPR1 || EXPR2	True if either EXPR1 or EXPR2 is true; else false
    
    When the `==' and `!=' operators are used, the string to the right of the
    operator is used as a pattern and pattern matching is performed.  The
    && and || operators do not evaluate EXPR2 if EXPR1 is sufficient to
    determine the expression's value.


nice and clear :-(

chrisb@box:~$ man -k [
apropos: fatal: regex `[': Invalid regular expression
chrisb@box:~$ man -k "["
apropos: fatal: regex `[': Invalid regular expression
chrisb@box:~$ man -k \[
apropos: fatal: regex `[': Invalid regular expression
chrisb@box:~$ man -k "\["
[ (1)                - check file types and compare values


I don't think the "bash builtin [" is the same as the "/usr/bin/["

chrisb@box:~$ man [

is the same as

chrisb@box:~$ man test

Any bash scripting guide/tutorial should explain its use in depth.

-- 
Chris.
======
-- 
Chris.
======


Reply to: