Weird cygwin executable

1

yesterday i was looking at my cygwin bin folder and i found a exe name [.exe when i execute it , it says "[ : missing ]" like this - enter image description here

when i execute it with ']' as a argument , it outputs nothing , could you please explain what this is?

Aurelian

Posted 2016-12-10T21:51:55.910

Reputation: 113

Answers

2

It’s an alias for test. See man 1 test:

Name

test - check file types and compare values

Synopsis

test EXPRESSION

test

[ EXPRESSION ]
[ ]
[ OPTION

The test command is sometimes used together with if to create a conditional block. It’s also useful on its own:

[ ! -d myDirectory ] && mkdir myDirectory

This would test whether a directory “myDirectory” does not exist and create it if that’s true.

Because it’s (also) for conditions, it must not print anything. Instead, it communicates via exit codes.

This command exists on virtually all GNU/Linux systems and many Unix variants.

See here for a more in-depth explanation.

Daniel B

Posted 2016-12-10T21:51:55.910

Reputation: 40 502