📄 test.1
字号:
.\" Copyright (c) 1991, 1993.\" The Regents of the University of California. All rights reserved..\" Copyright (c) 1997-2005.\" Herbert Xu <herbert@gondor.apana.org.au>. All rights reserved..\".\" This code is derived from software contributed to Berkeley by.\" the Institute of Electrical and Electronics Engineers, Inc..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\" notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\" notice, this list of conditions and the following disclaimer in the.\" documentation and/or other materials provided with the distribution..\" 3. Neither the name of the University nor the names of its contributors.\" may be used to endorse or promote products derived from this software.\" without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\" @(#)test.1 8.1 (Berkeley) 5/31/93.\".Dd May 31, 1993.Dt TEST 1.Os.Sh NAME.Nm test ,.Nm \&[.Nd condition evaluation utility.Sh SYNOPSIS.Nm test.Ar expression.Nm \&[.Ar expression Cm ].Sh DESCRIPTIONThe.Nm testutility evaluates the expression and, if it evaluatesto true, returns a zero (true) exit status; otherwiseit returns 1 (false).If there is no expression, test alsoreturns 1 (false)..PpAll operators and flags are separate arguments to the.Nm testutility..PpThe following primaries are used to construct expression:.Bl -tag -width Ar.It Fl b Ar fileTrue if.Ar fileexists and is a block specialfile..It Fl c Ar fileTrue if.Ar fileexists and is a characterspecial file..It Fl d Ar fileTrue if.Ar fileexists and is a directory..It Fl e Ar fileTrue if.Ar fileexists (regardless of type)..It Fl f Ar fileTrue if.Ar fileexists and is a regular file..It Fl g Ar fileTrue if.Ar fileexists and its set group ID flagis set..It Fl h Ar fileTrue if.Ar fileexists and is a symbolic link..It Fl k Ar fileTrue if.Ar fileexists and its sticky bit is set..It Fl n Ar stringTrue if the length of.Ar stringis nonzero..It Fl p Ar fileTrue if.Ar fileis a named pipe.Po Tn FIFO Pc ..It Fl r Ar fileTrue if.Ar fileexists and is readable..It Fl s Ar fileTrue if.Ar fileexists and has a size greaterthan zero..It Fl t Ar file_descriptorTrue if the file whose file descriptor numberis.Ar file_descriptoris open and is associated with a terminal..It Fl u Ar fileTrue if.Ar fileexists and its set user ID flagis set..It Fl w Ar fileTrue if.Ar fileexists and is writable.Trueindicates only that the write flag is on.The file is not writable on a read-only filesystem even if this test indicates true..It Fl x Ar fileTrue if.Ar fileexists and is executable.Trueindicates only that the execute flag is on.If.Ar fileis a directory, true indicates that.Ar filecan be searched..It Fl z Ar stringTrue if the length of.Ar stringis zero..It Fl L Ar fileTrue if.Ar fileexists and is a symbolic link.This operator is retained for compatibility with previous versions ofthis program.Do not rely on its existence; use.Fl hinstead..It Fl O Ar fileTrue if.Ar fileexists and its owner matches the effective user id of this process..It Fl G Ar fileTrue if.Ar fileexists and its group matches the effective group id of this process..It Fl S Ar fileTrue if.Ar fileexists and is a socket..It Ar file1 Fl nt Ar file2True if.Ar file1exists and is newer than.Ar file2 ..It Ar file1 Fl ot Ar file2True if.Ar file1exists and is older than.Ar file2 ..It Ar file1 Fl ef Ar file2True if.Ar file1and.Ar file2exist and refer to the same file..It Ar stringTrue if.Ar stringis not the nullstring..It Ar \&s\&1 Cm \&= Ar \&s\&2True if the strings.Ar \&s\&1and.Ar \&s\&2are identical..It Ar \&s\&1 Cm \&!= Ar \&s\&2True if the strings.Ar \&s\&1and.Ar \&s\&2are not identical..It Ar \&s\&1 Cm \&\*[Lt] Ar \&s\&2True if string.Ar \&s\&1comes before.Ar \&s\&2based on the ASCII value of their characters..It Ar \&s\&1 Cm \&\*[Gt] Ar \&s\&2True if string.Ar \&s\&1comes after.Ar \&s\&2based on the ASCII value of their characters..It Ar \&n\&1 Fl \&eq Ar \&n\&2True if the integers.Ar \&n\&1and.Ar \&n\&2are algebraicallyequal..It Ar \&n\&1 Fl \&ne Ar \&n\&2True if the integers.Ar \&n\&1and.Ar \&n\&2are notalgebraically equal..It Ar \&n\&1 Fl \> Ar \&n\&2True if the integer.Ar \&n\&1is algebraicallygreater than the integer.Ar \&n\&2 ..It Ar \&n\&1 Fl \&ge Ar \&n\&2True if the integer.Ar \&n\&1is algebraicallygreater than or equal to the integer.Ar \&n\&2 ..It Ar \&n\&1 Fl \< Ar \&n\&2True if the integer.Ar \&n\&1is algebraically lessthan the integer.Ar \&n\&2 ..It Ar \&n\&1 Fl \&le Ar \&n\&2True if the integer.Ar \&n\&1is algebraically lessthan or equal to the integer.Ar \&n\&2 ..El.PpThese primaries can be combined with the following operators:.Bl -tag -width Ar.It Cm \&! Ar expressionTrue if.Ar expressionis false..It Ar expression1 Fl a Ar expression2True if both.Ar expression1and.Ar expression2are true..It Ar expression1 Fl o Ar expression2True if either.Ar expression1or.Ar expression2are true..It Cm \&( Ns Ar expression Ns Cm \&)True if expression is true..El.PpThe.Fl aoperator has higher precedence than the.Fl ooperator..Sh GRAMMAR AMBIGUITYThe.Nm testgrammar is inherently ambiguous.In order to assure a degree of consistency, the cases described in.St -p1003.2section 4.62.4,are evaluated consistently according to the rules specified in thestandards document.All other cases are subject to the ambiguity in the command semantics..Sh EXIT STATUSThe.Nm testutility exits with one of the following values:.Bl -tag -width Ds.It 0expression evaluated to true..It 1expression evaluated to false or expression wasmissing..It \*[Gt]1An error occurred..El.Sh STANDARDSThe.Nm testutility implements a superset of the.St -p1003.2specification.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -