NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/42286: Minor mistakes, and one supposed error, in test(1) manpage
>Number: 42286
>Category: bin
>Synopsis: Minor mistakes, and one supposed error, in test(1) manpage
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: doc-bug
>Submitter-Id: net
>Arrival-Date: Sun Nov 08 21:05:01 +0000 2009
>Originator: Bug Hunting
>Release: 5.99.21
>Organization:
>Environment:
>Description:
The test(1) manpage contains some minor errors, namely, it doesn't
use nroff(1) macros on some locations where it should (or: could).
Also, although it is explicitly defined with `Ns' macros in the
manpage's nroff(1) source (and the manpage _does_ mention ``All
operators and flags are separate arguments to the test utility''),
showing no spacing after `(' and before `)' in the `(expression)' part
is very confusing, since those spaces are needed in shell. Since it is
unclear to me why `Ns' macros are used here, i suggest removing them.
>How-To-Repeat:
"man 1 test".
test(1) usage with parentheses:
$ /bin/test '('a = a')' && echo true || echo false # incorrect usage
false
$ /bin/test '(' a = a ')' && echo true || echo false # correct usage
true
>Fix:
Apply the following patch:
$ cvs diff -u bin/test/test.1
Index: bin/test/test.1
===================================================================
RCS file: /cvsroot/src/bin/test/test.1,v
retrieving revision 1.26
diff -u -r1.26 test.1
--- bin/test/test.1 6 May 2009 08:26:43 -0000 1.26
+++ bin/test/test.1 8 Nov 2009 20:57:15 -0000
@@ -32,7 +32,7 @@
.\"
.\" @(#)test.1 8.1 (Berkeley) 5/31/93
.\"
-.Dd May 5, 2009
+.Dd November 8, 2009
.Dt TEST 1
.Os
.Sh NAME
@@ -47,17 +47,24 @@
.Sh DESCRIPTION
The
.Nm test
-utility evaluates the expression and, if it evaluates
+utility evaluates
+.Ar expression
+and, if it evaluates
to true, returns a zero (true) exit status; otherwise
it returns 1 (false).
-If there is no expression, test also
+If
+.Ar expression
+is not given,
+.Nm test
+also
returns 1 (false).
.Pp
All operators and flags are separate arguments to the
.Nm test
utility.
.Pp
-The following primaries are used to construct expression:
+The following primaries are used to construct
+.Ar expression :
.Bl -tag -width Ar
.It Fl b Ar file
True if
@@ -269,8 +276,10 @@
or
.Ar expression2
are true.
-.It Cm \&( Ns Ar expression Ns Cm \&)
-True if expression is true.
+.It Cm \&( Ar expression Cm \&)
+True if
+.Ar expression
+is true.
.El
.Pp
The
@@ -300,10 +309,11 @@
utility exits with one of the following values:
.Bl -tag -width Ds
.It 0
-expression evaluated to true.
+.Ar expression
+evaluated to true.
.It 1
-expression evaluated to false or expression was
-missing.
+.Ar expression
+evaluated to false or was missing.
.It \*[Gt]1
An error occurred.
.El
Home |
Main Index |
Thread Index |
Old Index