[ is another name for
test. All three of those lines are command lines that run
test with some options.
In the first line, this is standard testing:
[ 5 -gt 4 ] is the same as
test 5 -gt 4.
In the second, the expression is omitted, which means to exit false (
0 arguments: Exit false (1)).
For the third case you are, I guess, using GNU coreutils. In GNU
test the help text contains this note:
NOTE: [ honors the --help and --version options, but test does not.
test treats each of those as it treats any other nonempty STRING.
This is a non-POSIX extension; the motivation seems to be that
test is required to treat those arguments as strings like any other.
[ is able to distinguish the option case from the string case by the presence of the closing
Note that your shell will likely provide its own
[, and so you'll have to
/bin/\[ to use this version.