The test utility shall evaluate the expression and indicate the result of the evaluation by its exit status. An exit status of zero indicates that the expression evaluated as true and an exit status of 1 indicates that the expression evaluated as false. The application shall ensure that all operators and elements of primaries are presented as separate arguments to the test utility. True if pathname resolves to an existing directory entry for a file that has its set-group-ID flag set. False if pathname cannot be resolved, or if pathname resolves to an existing directory entry for a file that does not have its set-group-ID flag set. True if pathname resolves to an existing directory entry for a file that has its set-user-ID flag set. False if pathname cannot be resolved, or if pathname resolves to an existing directory entry for a file that does not have its set-user-ID flag set. True if the string string is not the null string; otherwise, false. True if the strings s1 and s2 are not identical; otherwise, false. True if the integers n1 and n2 are algebraically equal; otherwise, false. True if the integers n1 and n2 are not algebraically equal; otherwise, false. With the exception of the -h pathname and -L pathname primaries, if a pathname argument is a symbolic link, test shall evaluate the expression by resolving the symbolic link and using the file referenced by the link. are known as unary primaries . The primaries with three elements in either of the two forms: The algorithm for determining the precedence of the operators and the return value that shall be generated is based on the number of arguments presented to test . (However, when using the "[...]" form, the final argument shall not be counted in this algorithm.) [OB XSI) ] ![[Option Start]]( On XSI-conformant systems, combinations of primaries and operators shall be evaluated using the precedence and associativity rules described previously. In addition, the string comparison binary primaries '=' and "!=" shall have a higher precedence than any unary primary. ![[Option End]]( Provide a default value for the internationalization variables that are unset or null. (See XBD Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) If set to a non-empty string value, override the values of all the other internationalization variables. Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. [XSI) ] ![[Option Start]]( Determine the location of message catalogs for the processing of LC MESSAGES. ![[Option End]]( The XSI extensions specifying the -a and -o binary primaries and the '(' and ')' operators have been marked obsolescent. (Many expressions using them are ambiguously defined by the grammar depending on the specific expressions being evaluated.) Scripts using these expressions should be converted to the forms given below. Even though many implementations will continue to support these obsolescent forms, scripts should be extremely careful when dealing with user-supplied input that could be confused with these and other primaries and operators. Unless the application developer knows all the cases that produce input to the script, invocations like: Note that the second form assumes that expected string could not be confused with any unary primary. If expected string starts with '-', '(', '!', or even '=', the first form should be used instead. Using the preceding rules without the XSI marked extensions, any of the three comparison forms is reliable, given any input. (However, note that the strings are quoted in all cases.) Because the string comparison binary primaries, '=' and "!=", have a higher precedence than any unary primary in the greater than 4 argument case, unexpected results can occur if arguments are not properly prepared. For example, in: In the first two cases, if a utility named [-f exists, tha
Excerpt from a page describing this subject · 28,185 chars · not written by Vinony
via Wikidata · CC0
Discovered by embedding cosine similarity (sentence-transformers MiniLM, 384-dim).