skaembutils
Software
www.skarnet.org
The test program
test is a standard UNIX test: it performs a test,
and exits 0 (true) or 1 (false).
Interface
test [ test expression ]
- Every kind of test expression required by the
Single
Unix v3 Specification is supported, as well as every feature
of GNU test except -l (and --help and
--version... of course). Look at the source code of
test to have the full list of supported expressions.
- Up to 1022 arguments are supported. You can build very long
test expressions using parentheses and the -a
and -o switches.
- If an argument starts with a backslash, it is considered
as a string or a filename, and the backslash is removed. For instance,
test -f -a leads to a parse error, but test -f \\-a
correctly tests the presence of a file named -a (the first
backslash being removed by the shell). This feature is not SUSv3-compliant,
but is much saner and simpler to both implement and use than the
strict SUSv3 behaviour.
Notes
test is very small, and it does not dynamically allocate memory.
If you need more than 1022 arguments to test, change
the definition of TOKEN_MAX in test.c and recompile.
test was co-written with Jean Marot.