📄 test.1
字号:
.\" SCCSID: @(#)test.1 8.1 9/11/90.TH test 1 .SH Nametest \- test conditional expression.SH Syntax.B test.I expr.br[.I expr].SH Description.NXR "test command".NXA "test command" "find command"The.PN testcommand evaluates the expression.IR expr .If the value of.IR expris true, the.PN testcommand returns a zero exit status; otherwise, itreturns a nonzero exit status. The.PN testcommand also returns a nonzero exit status if no arguments are specified..SH OptionsThe following primitives are used to construct.IR expr :.TP 20\fB\-\|r\fI file\fRTests if the file exists and is readable..TP 20\fB\-\|w\fI file\fRTests if the file exists and is writable..TP 20 \fB\-\|f\fI file\fRTests if the file exists and is not a directory..TP 20 \fB\-\|d\fI file\fRTests if the file exists and is a directory..TP 20 \fB\-\|s\fI file\fRTests if the file exists and has a size greater than zero..TP 20 \fB\-t\fR [\fI fildes\fR ]Tests if the open file, whose file descriptor number is .I fildes (1 by default), is associated with a terminal device..TP 20 \fB\-\|z\fI s1\fRTests if the length of string.I s1is zero..TP 20 \fB\-\|n\fI s1\fR Tests if the length of the string.I s1is nonzero..TP 20 \fIs1 = s2\fRTestsif the strings.I s1and.I s2are equal..TP 20\fIs1 != s2\fRTestsif the strings.I s1and.I s2are not equal..TP\fIs1\fRTests if.I s1is not the null string..TP 20\fRn1 \fB\-eq\fR n2Tests if number1 equals number2. .TP 20\fRn1 \fB\-ge\fR n2Tests if number1 is greater than or equal to number2. .TP 20\fRn1 \fB\-gt\fR n2Tests if number1 is greater than number2. .TP 20\fRn1 \fB\-le\fR n2Tests if number1 is less than or equal to number2..TP 20\fRn1 \fB\-lt\fR n2Tests if number1 is less than number2. .TP 20\fRn1 \fB\-ne\fR n2Tests if number1 is not equal to number2. .PPThese primitives can be combined with thefollowing operators:.TP 20\fR!exprNegates evaluation of expression. .TP 20\fRexpr \fB\-a\fR exprTests logical.I andof two expressions. .TP 20\fRexpr \fB\-o\fR exprTests logical.I orof two expressions. .TP 20 \fR( expr... )Groups expressions. .PPThe.B \-aoperator takes precedence over the.B \-ooperator. Note that all the operators and flags are separatearguments to.PN test .Note also that parentheses are meaningfulto the Shell and must be escaped..SH See Alsofind(1), sh(1), test(1sh5)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -