What does the gnuwin32 program do: [.exe do?

Looking into the gnuwin32 / bin directory, there is an odd program file named [.exe

I could not find it in the documentation, gnuwin32.sourceforge.net or in a google search, so I ran it and got:

$ [
[: missing `]'
$

so I gave it] as a parameter and got

$ [ ]

$

He did not complain, so I decided that it was on the right track. I tried:

$ [ hello ]

again, no complaints. so I tried the arithmetic expression:

$ [ 1 + 1 ]
[: +: binary operator expected
$

I tried a bunch of different combinations, including prefix and postfix notation, but nothing worked. What does this thing do?

+3
source share
3 answers

. (, ?) test.
man .

bash:

if [ "$LOGNAME" = "scott" ]
then
    echo "Logged in as Scott"
else
     echo "incorrect user"
fi

, [ bash, , "IF". [ - , script ["$LOGNAME" .

- expr (. ). , ( , ..), .

+5
test a

==

[ a ]

: , , . [ "a" = "a" ]

+6

Another answer has already been mentioned as the same as test. In bash, it is also built-in, so you can get help for it with helpbuiltin ( help test).

0
source

All Articles