summaryrefslogtreecommitdiffstats
path: root/bin/expr
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>2002-03-22 20:38:44 +0000
committerwollman <wollman@FreeBSD.org>2002-03-22 20:38:44 +0000
commitc1037fd271f807b973718abeb7ceedb9d2e8334b (patch)
tree8ede1855becd0ae14b5007aaac965ad033a1caa5 /bin/expr
parent11a0c28ba7f034c551481b25e6f6ff52814ed2a5 (diff)
downloadFreeBSD-src-c1037fd271f807b973718abeb7ceedb9d2e8334b.zip
FreeBSD-src-c1037fd271f807b973718abeb7ceedb9d2e8334b.tar.gz
Fix a few formatting brainos and make the formatting of the EXAMPLES
section somewhat clearer.
Diffstat (limited to 'bin/expr')
-rw-r--r--bin/expr/expr.115
1 files changed, 9 insertions, 6 deletions
diff --git a/bin/expr/expr.1 b/bin/expr/expr.1
index 2c4fb792..fed0d30 100644
--- a/bin/expr/expr.1
+++ b/bin/expr/expr.1
@@ -142,14 +142,14 @@ command in general is historic and inconvenient.
New applications are advised to use shell arithmetic rather than
.Nm .
.Sh EXAMPLES
-.Bl -enum
+.Bl -bullet
.It
The following example (in
.Xr sh 1
syntax) adds one to the variable
-.Va a .
+.Va a :
.Dl a=$(expr $a + 1)
-.Li
+.It
This will fail if the value if
.Va a
is a negative number.
@@ -159,7 +159,7 @@ from being interpreted as options to the
.Nm
command, one might rearrange the expression:
.Dl a=$(expr 1 + $a)
-.Li
+.It
More generally, parenthesize possibly-negative values:
.Dl a=$(expr \e( $a \e) + 1)
.It
@@ -175,7 +175,8 @@ The
.Li //
characters resolve this ambiguity.
.Dl expr \*q//$a\*q \&: '.*/\e(.*\e)'
-.It
+.El
+.Pp
The following examples output the number of characters in variable
.Va a .
Again, if
@@ -183,13 +184,15 @@ Again, if
might begin with a hyphen, it is necessary to prevent it from being
interpreted as an option to
.Nm .
+.Bl -bullet
+.It
If the
.Nm
command conforms to
.St -p1003.1-2001 ,
this is simple:
.Dl expr -- \*q$a\*q \&: \*q.*\*q
-.Li
+.It
For portability to older systems, however, a more complicated command
is required:
.Dl expr \e( \*qX$a\*q \&: \*q.*\*q \e) - 1
OpenPOWER on IntegriCloud