Files
oldlinux-files/Minix/2.0.0/wwwman/man1/test.1.html
2024-02-19 00:21:39 -05:00

74 lines
2.0 KiB
HTML

<HTML>
<HEAD>
<TITLE>test(1)</TITLE>
</HEAD>
<BODY>
<H1>test(1)</H1>
<HR>
<PRE>
</PRE>
<H2>NAME</H2><PRE>
test, [ - test for a condition
</PRE>
<H2>SYNOPSIS</H2><PRE>
<STRONG>test</STRONG> <EM>expr</EM>
<STRONG>[</STRONG> <EM>expr</EM> <STRONG>]</STRONG>
</PRE>
<H2>OPTIONS</H2><PRE>
(none)
</PRE>
<H2>EXAMPLES</H2><PRE>
<STRONG>test</STRONG> <STRONG>-r</STRONG> <STRONG>file</STRONG> # See if file is readable
</PRE>
<H2>DESCRIPTION</H2><PRE>
<EM>Test</EM> checks to see if files exist, are readable, etc. and returns an exit
status of zero if true and nonzero if false. The legal operators are
-r file true if the file is readable
-w file true if the file is writable
-x file true if the file is executable
-f file true if the file is not a directory
-d file true if the file is a directory
-s file true if the file exists and has a size &gt; 0
-t fd true if file descriptor fd (default 1) is a terminal
-z s true if the string s has zero length
-n s true if the string s has nonzero length
s1 = s2 true if the strings s1 and s2 are identical
s1 != s2 true if the strings s1 and s2 are different
m -eq m true if the integers m and n are numerically equal
The operators <STRONG>-gt</STRONG>, <STRONG>-ge</STRONG>, <STRONG>-ne</STRONG>, <STRONG>-le</STRONG>, and <STRONG>-lt</STRONG> may be used as well. These
operands may be combined with <STRONG>-a</STRONG> (Boolean and), <STRONG>-o</STRONG> (Boolean or), !
(negation). The priority of <STRONG>-a</STRONG> is higher than that of <STRONG>-o</STRONG>. Parentheses are
permitted, but must be escaped to keep the shell from trying to interpret
them.
</PRE>
<H2>SEE ALSO</H2><PRE>
<STRONG><A HREF="../man1/expr.1.html">expr(1)</A></STRONG>, <STRONG><A HREF="../man1/sh.1.html">sh(1)</A></STRONG>.
</PRE>
</BODY>
</HTML>