aboutsummaryrefslogtreecommitdiff
path: root/man/man1/test.html
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-01-14 03:45:44 +0000
committerrsc <devnull@localhost>2005-01-14 03:45:44 +0000
commit78e51a8c6678b6e3dff3d619aa786669f531f4bc (patch)
tree015e00fde4fc837fd31b705e18d17dc913829388 /man/man1/test.html
parent2634795b5f0053bc0ff08e5d7bbc0eda8efea061 (diff)
downloadplan9port-78e51a8c6678b6e3dff3d619aa786669f531f4bc.tar.gz
plan9port-78e51a8c6678b6e3dff3d619aa786669f531f4bc.tar.bz2
plan9port-78e51a8c6678b6e3dff3d619aa786669f531f4bc.zip
checkpoint
Diffstat (limited to 'man/man1/test.html')
-rw-r--r--man/man1/test.html156
1 files changed, 156 insertions, 0 deletions
diff --git a/man/man1/test.html b/man/man1/test.html
new file mode 100644
index 00000000..0f3fa85d
--- /dev/null
+++ b/man/man1/test.html
@@ -0,0 +1,156 @@
+<head>
+<title>test(1) - Plan 9 from User Space</title>
+<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
+</head>
+<body bgcolor=#ffffff>
+<table border=0 cellpadding=0 cellspacing=0 width=100%>
+<tr height=10><td>
+<tr><td width=20><td>
+<tr><td width=20><td><b>TEST(1)</b><td align=right><b>TEST(1)</b>
+<tr><td width=20><td colspan=2>
+ <br>
+<p><font size=+1><b>NAME </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ test &ndash; set status according to condition<br>
+
+</table>
+<p><font size=+1><b>SYNOPSIS </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <tt><font size=+1>test</font></tt> <i>expr<br>
+ </i>
+</table>
+<p><font size=+1><b>DESCRIPTION </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <i>Test</i> evaluates the expression <i>expr</i>. If the value is true the exit
+ status is null; otherwise the exit status is non-null. If there
+ are no arguments the exit status is non-null.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ The following primitives are used to construct <i>expr</i>.<br>
+ <tt><font size=+1>&#8722;r</font></tt> <i>file</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;True if the file exists (is accessible) and is readable.<br>
+ <tt><font size=+1>&#8722;w</font></tt> <i>file</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;True if the file exists and is writable.<br>
+ <tt><font size=+1>&#8722;x</font></tt> <i>file</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;True if the file exists and has execute permission.<br>
+ <tt><font size=+1>&#8722;e</font></tt> <i>file</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;True if the file exists.<br>
+ <tt><font size=+1>&#8722;f</font></tt> <i>file</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;True if the file exists and is a plain file.<br>
+ <tt><font size=+1>&#8722;d</font></tt> <i>file</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;True if the file exists and is a directory.<br>
+ <tt><font size=+1>&#8722;s</font></tt> <i>file</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;True if the file exists and has a size greater than zero.<br>
+ <tt><font size=+1>&#8722;t</font></tt> <i>fildes</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;True if the open file whose file descriptor number is
+ <i>fildes</i> (1 by default) is the same file as <tt><font size=+1>/dev/cons</font></tt>.<br>
+ <tt><font size=+1>&#8722;A</font></tt> <i>file</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;True if the file exists and is append-only.<br>
+ <tt><font size=+1>&#8722;L</font></tt> <i>file</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;True if the file exists and is exclusive-use.<br>
+ <tt><font size=+1>&#8722;T</font></tt><i>file</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;True if the file exists and is temporary.<br>
+ <i>s1</i> <tt><font size=+1>=</font></tt> <i>s2</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;True if the strings <i>s1</i> and <i>s2</i> are identical.<br>
+ <i>s1</i> <tt><font size=+1>!=</font></tt> <i>s2</i>&nbsp;&nbsp;&nbsp;&nbsp;True if the strings <i>s1</i> and <i>s2</i> are not identical.<br>
+ s1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;True if <i>s1</i> is not the null string. (Deprecated.)<br>
+ <tt><font size=+1>&#8722;n</font></tt> <i>s1</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;True if the length of string <i>s1</i> is non-zero.<br>
+ <tt><font size=+1>&#8722;z</font></tt> <i>s1</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;True if the length of string <i>s1</i> is zero.<br>
+ <i>n1</i> <tt><font size=+1>&#8722;eq</font></tt> <i>n2</i>True if the integers <i>n1</i> and <i>n2</i> are arithmetically equal.
+ Any of the comparisons <tt><font size=+1>&#8722;ne</font></tt>, <tt><font size=+1>&#8722;gt</font></tt>, <tt><font size=+1>&#8722;ge</font></tt>, <tt><font size=+1>&#8722;lt</font></tt>, or <tt><font size=+1>&#8722;le</font></tt> may be used
+ in place of <tt><font size=+1>&#8722;eq</font></tt>. The (nonstandard) construct <tt><font size=+1>&#8722;l</font></tt> <i>string</i>, meaning
+ the length of <i>string</i>, may be used in place of an integer.<br>
+ <i>a</i> <tt><font size=+1>&#8722;nt</font></tt> <i>b</i>&nbsp;&nbsp;&nbsp;&nbsp;True if file <i>a</i> is newer than (modified after) file <i>b</i>.<br>
+ <i>a</i> <tt><font size=+1>&#8722;ot</font></tt> <i>b</i>&nbsp;&nbsp;&nbsp;&nbsp;True if file <i>a</i> is older than (modified before) file <i>b</i>.<br>
+ <i>f</i> <tt><font size=+1>&#8722;older</font></tt> <i>t</i>True if file <i>f</i> is older than (modified before) time
+ <i>t</i>. If <i>t</i> is a integer followed by the letters <tt><font size=+1>y</font></tt>(years), <tt><font size=+1>M</font></tt>(months),
+ <tt><font size=+1>d</font></tt>(days), <tt><font size=+1>h</font></tt>(hours), <tt><font size=+1>m</font></tt>(minutes), or <tt><font size=+1>s</font></tt>(seconds), it represents current
+ time minus the specified time. If there is no letter, it represents
+ seconds since epoch. You can also concatenate mixed units.
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ For example, <tt><font size=+1>3d12h</font></tt> means three days and twelve hours ago.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+
+ </table>
+
+ </table>
+ These primaries may be combined with the following operators:<br>
+ <tt><font size=+1>!</font></tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unary negation operator<br>
+ <tt><font size=+1>&#8722;o</font></tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;binary <i>or</i> operator<br>
+ <tt><font size=+1>&#8722;a</font></tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;binary <i>and</i> operator; higher precedence than <tt><font size=+1>&#8722;o<br>
+ (</font></tt> <i>expr</i> <tt><font size=+1>)</font></tt>&nbsp;&nbsp;&nbsp;parentheses for grouping.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ The primitives <tt><font size=+1>&#8722;b</font></tt>, <tt><font size=+1>&#8722;u</font></tt>, <tt><font size=+1>&#8722;g</font></tt>, and <tt><font size=+1>&#8722;s</font></tt> return false; they are recognized
+ for compatibility with POSIX.
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+
+ Notice that all the operators and flags are separate arguments
+ to <i>test</i>. Notice also that parentheses and equal signs are meaningful
+ to <i>rc</i> and must be enclosed in quotes.<br>
+
+</table>
+<p><font size=+1><b>EXAMPLES </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <i>Test</i> is a dubious way to check for specific character strings:
+ it uses a process to do what an <a href="../man1/rc.html"><i>rc</i>(1)</a> match or switch statement
+ can do. The first example is not only inefficient but wrong, because
+ <i>test</i> understands the purported string <tt><font size=+1>&quot;&#8722;c&quot;</font></tt> as an option.<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <tt><font size=+1>if (test $1 '=' &quot;&#8722;c&quot;) echo OK # wrong!<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+
+ </table>
+ A better way is<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <tt><font size=+1>if (~ $1 &#8722;c) echo OK<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
+ </font></tt>
+
+ </table>
+ Test whether <tt><font size=+1>abc</font></tt> is in the current directory.<br>
+
+ <table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <tt><font size=+1>test &#8722;f abc &#8722;o &#8722;d abc<br>
+ </font></tt>
+ </table>
+
+</table>
+<p><font size=+1><b>SOURCE </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <tt><font size=+1>/usr/local/plan9/src/cmd/test.c<br>
+ </font></tt>
+</table>
+<p><font size=+1><b>SEE ALSO </b></font><br>
+
+<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
+
+ <a href="../man1/rc.html"><i>rc</i>(1)</a><br>
+
+</table>
+
+<td width=20>
+<tr height=20><td>
+</table>
+<!-- TRAILER -->
+<table border=0 cellpadding=0 cellspacing=0 width=100%>
+<tr height=15><td width=10><td><td width=10>
+<tr><td><td>
+<center>
+<a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a>
+</center>
+</table>
+<!-- TRAILER -->
+</body></html>