aboutsummaryrefslogtreecommitdiff
path: root/bin/expr
diff options
context:
space:
mode:
authorJ.T. Conklin <jtc@FreeBSD.org>1993-10-04 22:07:27 +0000
committerJ.T. Conklin <jtc@FreeBSD.org>1993-10-04 22:07:27 +0000
commitd8c21a3e8ada7bf2d60f6327413e40950794960c (patch)
treefcb081a2753cba04ed4f3beb8c3ec71b7e48fa5f /bin/expr
parent4a13ab7c12be6a84cfbb88bf6fe64ae3ca79f08e (diff)
downloadsrc-d8c21a3e8ada7bf2d60f6327413e40950794960c.tar.gz
src-d8c21a3e8ada7bf2d60f6327413e40950794960c.zip
Document the new, less restrictive, behavior of the matching operator.
Notes
Notes: svn path=/head/; revision=540
Diffstat (limited to 'bin/expr')
-rw-r--r--bin/expr/expr.129
1 files changed, 15 insertions, 14 deletions
diff --git a/bin/expr/expr.1 b/bin/expr/expr.1
index e4d3c0648289..a592564f8ddd 100644
--- a/bin/expr/expr.1
+++ b/bin/expr/expr.1
@@ -1,3 +1,5 @@
+.\" -*- nroff -*-
+.\"
.\" Copyright (c) 1993 Winning Strategies, Inc.
.\" All rights reserved.
.\"
@@ -26,7 +28,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $Header: /b/source/CVS/src/bin/expr/expr.1,v 1.1 1993/07/20 20:16:26 jtc Exp $
+.\" $Id: expr.1,v 1.5 1993/10/04 22:06:59 jtc Exp $
.\"
.Dd July 3, 1993
.Dt EXPR 1
@@ -65,7 +67,8 @@ if neither expression evaluates to an empty string or zero;
otherwise, returns zero.
.It Ar expr1 Li "{=, >, >=, <, <=, !=}" Ar expr2
Returns the results of integer comparision if both arguments are integers;
-otherwise, returns the results of lexical comparison.
+otherwise, returns the results of string comparison using the locale-specific
+collation sequence.
The result of each comparison is 1 if the specified relation is true,
or 0 if the relation is false.
.It Ar expr1 Li "{+, -}" Ar expr2
@@ -80,19 +83,19 @@ operator matches
against
.Ar expr2 ,
which must be a regular expression. The regular expression is anchored
-to the begining of the string with an invisible
-.Dq ^ ,
-therefore
-.Dq ^
-is not a special character.
+to the begining of the string with an implicit
+.Dq ^ .
.Pp
-If the pattern contains at lest one regular expression
-subexpression
+If the match succeeds and the pattern contains at least one regular
+expression subexpression
.Dq "\e(...\e)" ,
the string corresponding to
.Dq "\e1"
is returned;
otherwise the matching operator returns the number of characters matched.
+If the match fails and the pattern contains a regular expression subexpression
+the null string is returned;
+otherwise 0.
.El
.Pp
Parentheses are used for grouping in the usual manner.
@@ -114,7 +117,7 @@ The following example returns the number of characters in variable a.
The
.Nm expr
utility exits with one of the following values:
-.Bl -tag -width Ds
+.Bl -tag -width Ds -compact
.It 0
the expression is neither an empty string nor 0.
.It 1
@@ -125,7 +128,5 @@ the expression is invalid.
.Sh STANDARDS
The
.Nm expr
-utility
-is expected to be
-.St -p1003.2
-compatible.
+utility conforms to
+.St -p1003.2 .