.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.30) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "TEST 1" .TH TEST 1 "2001-06-06" "perl v5.20.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" test \- condition evaluation utility .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& test expression \& [ expression ] .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" The \fBtest\fR utility evaluates the \fIexpression\fR and, if it evaluates to true, returns a zero (true) exit status; otherwise it returns 1 (false). If no expression is given, \fBtest\fR also returns 1 (false). .PP All operators and flags are separate arguments to the test utility. .PP The following primaries are used to construct expression: .IP "\fB\-b\fR \fIfile\fR" 14 .IX Item "-b file" True if file exists and is a block special file. .IP "\fB\-c\fR \fIfile\fR" 14 .IX Item "-c file" True if file exists and is a character special file. .IP "\fB\-d\fR \fIfile\fR" 14 .IX Item "-d file" True if file exists and is a directory. .IP "\fB\-e\fR \fIfile\fR" 14 .IX Item "-e file" True if file exists (regardless of type). .IP "\fB\-f\fR \fIfile\fR" 14 .IX Item "-f file" True if file exists and is a regular file. .IP "\fB\-g\fR \fIfile\fR" 14 .IX Item "-g file" True if file exists and its set-group-ID flag is set. .IP "\fB\-h\fR \fIfile\fR" 14 .IX Item "-h file" True if file exists and is a symbolic link. This operator is for \&\s-1COMPATABILITY\s0 purposes, do not rely on its existence. Use \fB\-L\fR instead. .IP "\fB\-k\fR \fIfile\fR" 14 .IX Item "-k file" True if file exists and its sticky bit is set. .IP "\fB\-n\fR \fIstring\fR" 14 .IX Item "-n string" True if the length of string is nonzero. .IP "\fB\-p\fR \fIfile\fR" 14 .IX Item "-p file" True if file is a named pipe (\s-1FIFO\s0). .IP "\fB\-r\fR \fIfile\fR" 14 .IX Item "-r file" True if file exists and is readable by the effective user/group. .IP "\fB\-s\fR \fIfile\fR" 14 .IX Item "-s file" True if file exists and has a size greater than zero. .IP "\fB\-t\fR \fIfile_descriptor\fR" 14 .IX Item "-t file_descriptor" True if the file whose file descriptor number is \fIfile_descriptor\fR is open and is associated with a terminal. .IP "\fB\-t\fR" 14 .IX Item "-t" Same as above with an implicit file descriptor number of \*(L"1\*(R" (e.g.: \fB\-t\fR 1). .IP "\fB\-u\fR \fIfile\fR" 14 .IX Item "-u file" True if file exists and its set-user-ID flag is set. .IP "\fB\-w\fR \fIfile\fR" 14 .IX Item "-w file" True if file exists and is writable by the effective user/group. True indicates only that the write flag is on. The file is not writable on a read-only file system even if this test indicates true. .IP "\fB\-x\fR \fIfile\fR" 14 .IX Item "-x file" True if file exists and is executable by the effective user/group. True indicates only that the execute flag is on. If file is a directory, true indicates that file can be searched. .IP "\fB\-z\fR \fIstring\fR" 14 .IX Item "-z string" True if the length of string is zero. .IP "\fB\-B\fR \fIfile\fR" 14 .IX Item "-B file" True if file exists and is a binary file. .IP "\fB\-L\fR \fIfile\fR" 14 .IX Item "-L file" True if file exists and is a symbolic link. .IP "\fB\-O\fR \fIfile\fR" 14 .IX Item "-O file" True if file exists and its owner matches the effective user \s-1ID\s0 of this process. .IP "\fB\-R\fR \fIfile\fR" 14 .IX Item "-R file" True if file exists and is readable by the real user/group. .IP "\fB\-S\fR \fIfile\fR" 14 .IX Item "-S file" True if file exists and is a socket. .IP "\fB\-T\fR \fIfile\fR" 14 .IX Item "-T file" True if file exists and is a text file. .IP "\fB\-W\fR \fIfile\fR" 14 .IX Item "-W file" True if file exists and is writable by the real user/group. True indicates only that the write flag is on. The file is not writable on a read-only file system even if this test indicates true. .IP "\fB\-X\fR \fIfile\fR" 14 .IX Item "-X file" True if file exists and is executable by the real user/group. True indicates only that the execute flag is on. If file is a directory, true indicates that file can be searched. .IP "\fIfile1\fR \fB\-nt\fR \fIfile2\fR" 14 .IX Item "file1 -nt file2" True if \fIfile1\fR exists and is newer than \fIfile2\fR. .IP "\fIfile1\fR \fB\-ot\fR \fIfile2\fR" 14 .IX Item "file1 -ot file2" True if \fIfile1\fR exists and is older than \fIfile2\fR. .IP "\fIstring\fR" 14 .IX Item "string" True if \fIstring\fR is not the null string. .IP "\fIs1\fR = \fIs2\fR" 14 .IX Item "s1 = s2" True if the strings \fIs1\fR and \fIs2\fR are identical. .IP "\fIs1\fR != \fIs2\fR" 14 .IX Item "s1 != s2" True if the strings \fIs1\fR and \fIs2\fR are not identical. .IP "\fIs1\fR < \fIs2\fR" 14 .IX Item "s1 < s2" True if string \fIs1\fR comes before \fIs2\fR based on the \s-1ASCII\s0 value of their characters. .IP "\fIs1\fR > \fIs2\fR" 14 .IX Item "s1 > s2" True if string \fIs1\fR comes after \fIs2\fR based on the \s-1ASCII\s0 value of their characters. .IP "\fIs1\fR" 14 .IX Item "s1" True if \fIs1\fR is not the null string. .IP "\fIn1\fR \fB\-eq\fR \fIn2\fR" 14 .IX Item "n1 -eq n2" True if the integers \fIn1\fR and \fIn2\fR are algebraically equal. .IP "\fIn1\fR \fB\-ne\fR \fIn2\fR" 14 .IX Item "n1 -ne n2" True if the integers \fIn1\fR and \fIn2\fR are not algebraically equal. .IP "\fIn1\fR \fB\-gt\fR \fIn2\fR" 14 .IX Item "n1 -gt n2" True if the integer \fIn1\fR is algebraically greater than the integer \fIn2\fR. .IP "\fIn1\fR \fB\-ge\fR \fIn2\fR" 14 .IX Item "n1 -ge n2" True if the integer \fIn1\fR is algebraically greater than or equal to the integer \fIn2\fR. .IP "\fIn1\fR \fB\-lt\fR \fIn2\fR" 14 .IX Item "n1 -lt n2" True if the integer \fIn1\fR is algebraically less than the integer \fIn2\fR. .IP "\fIn1\fR \fB\-le\fR \fIn2\fR" 14 .IX Item "n1 -le n2" True if the integer \fIn1\fR is algebraically less than or equal to the integer \fIn2\fR. .PP These primaries can be combined with the following operators: .IP "! \fIexpression\fR" 14 .IX Item "! expression" True if \fIexpression\fR is false. .IP "\fIexpression1\fR \fB\-a\fR \fIexpression2\fR" 14 .IX Item "expression1 -a expression2" True if both \fIexpression1\fR and \fIexpression2\fR are true. .IP "\fIexpression1\fR \fB\-o\fR \fIexpression2\fR" 14 .IX Item "expression1 -o expression2" True if either \fIexpression1\fR or \fIexpression2\fR are true. .IP "(\fIexpression\fR)" 14 .IX Item "(expression)" True if \fIexpression\fR is true (uses parentheses for grouping). .PP Note that the \fB\-a\fR operator has higher precedence than the \fB\-o\fR operator. Notice also that all the operators and flags are separate arguments to test. .SH "RETURN VALUES" .IX Header "RETURN VALUES" The test utility exits with one of the following values: .ie n .IP "$return_val == 0" 8 .el .IP "\f(CW$return_val\fR == 0" 8 .IX Item "$return_val == 0" Expression evaluated to true. .ie n .IP "$return_val == 1" 8 .el .IP "\f(CW$return_val\fR == 1" 8 .IX Item "$return_val == 1" Expression evaluated to false or expression was missing. .ie n .IP "$return_val > 1" 8 .el .IP "\f(CW$return_val\fR > 1" 8 .IX Item "$return_val > 1" An error occurred. .SH "CAVEATS" .IX Header "CAVEATS" Command line arguments like parentheses and arithmetic operators (e.g.: '(', ')', '!', '>', '<', etc.) \fImay\fR be meaningful to the command-line interpreter (shell) and therefore \fImay\fR need to be escaped from any special shell interpretation. .SH "SEE ALSO" .IX Header "SEE ALSO" sh, find