s6-portable-utils
Software
skarnet.org
The s6-test program
s6-test evaluates an expression and indicates the result via its
exit status.
Interface
s6-test expression...
s6-test acts as the generic
test utility,
but it diverges from the specification on one point: if an argument starts with a backslash,
this backslash is ignored (and the argument cannot be an operation). This is a simple
disambiguation technique that has unfortunately not been chosen by the standard.
s6-test accepts an arbitrary number of arguments.
Exit codes
- 0: the test is true
- 1: the test is false
- 100: wrong usage
- 101: internal error (should never happen, warrants a bug-report)
- 111: system call failure
Posixness
s6-test is not suitable as a Single Unix
test
program; however, if your arguments never start with a backslash, it exhibits the
exact same behaviour.
Non-standard expressions
- -v VAR : tests whether the
VAR variable is defined in the current environment.
- string =~ pattern :
tries to match string against extended regular expression
pattern. True if any part of string matches pattern;
in order to match whole strings, you must anchor pattern with
^ and $ markers.
Notes
- This program is deprecated. It will disappear in a
near future version of s6-portable-utils. You are encouraged to use
eltest
instead, which has the same interface and functionality, and is a part of the
execline package.