Question about "[" file

Discussion in 'macOS' started by yagooapple, May 10, 2010.

  1. yagooapple macrumors newbie

    Joined:
    May 10, 2010
    #1
    I wonder if anyone know about this file in the /bin directory: [ -- it is just the left square bracket (do 'cd /bin' followed by 'ls'). I'm not sure if I should just delete it ... Any advice will be appreciated.
     
  2. miles01110 macrumors Core

    miles01110

    Joined:
    Jul 24, 2006
    Location:
    The Ivory Tower (I'm not coming down)
    #2
    Just leave it alone. Don't touch anything in the /bin folder for that matter.
     
  3. maflynn Moderator

    maflynn

    Staff Member

    Joined:
    May 3, 2009
    Location:
    Boston
    #3
    There's certain directories shouldn't be poking around and that's one of them. Any changes to some of these system directories will leave your mac unstable/unable to boot.
     
  4. -aggie- macrumors P6

    -aggie-

    Joined:
    Jun 19, 2009
    Location:
    Where bunnies are welcome.
    #4
    Here's a good rule to follow: If you aren't sure what something is, don't delete it, ESPECIALLY in system directories.
     
  5. yagooapple thread starter macrumors newbie

    Joined:
    May 10, 2010
    #5
    Thanks for all the replies. But a filename given by the left bracket really looks suspicious and weird? ... If anything comes up, would greatly appreciate to learn more about it. Again, thanks for the helps. I'll leave it for the time being ...

    Y.A.
     
  6. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #7
    Not for system files, it doesn't.
     
  7. Hal Itosis macrumors 6502a

    Hal Itosis

    Joined:
    Feb 20, 2010
    #8
    Code:
    [SIZE="2"]
    yagooapple$ [color=blue]ls -li /bin/[[/color]
    25857 -r-xr-xr-x  [COLOR="Magenta"]2[/COLOR] root  wheel  63184 May 18  2009 /bin/[
    
    yagooapple$ [color=blue]find -f {,/usr}/{,s}bin /usr/libexec -inum 25857 -exec ls -li {} +[/color]
    25857 -r-xr-xr-x  2 root  wheel  63184 May 18  2009 /bin/[
    25857 -r-xr-xr-x  2 root  wheel  63184 May 18  2009 /bin/[COLOR="Magenta"]test[/COLOR]
    
    yagooapple$ [color=blue]file /bin/[[/color]
    /bin/[: Mach-O universal binary with 3 architectures
    /bin/[ (for architecture x86_64):	Mach-O 64-bit executable x86_64
    /bin/[ (for architecture i386):		Mach-O executable i386
    /bin/[ (for architecture ppc7400):	Mach-O executable ppc
    
    yagooapple$ [color=blue]type [[/color]
    [ is a shell builtin
    
    yagooapple$ [color=blue]help [[/color]
    [: [ 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.
    yagooapple$ [/SIZE]
    ;)


    Code:
    [SIZE="2"]
    yagooapple$ [COLOR="Magenta"][SIZE="3"][[/SIZE][/COLOR] [COLOR="Blue"]"$unix_expert" = true ] && echo yes || echo no[/COLOR]
    no[/SIZE]
    :p
     
  8. yagooapple thread starter macrumors newbie

    Joined:
    May 10, 2010

Share This Page