summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2018-12-16 13:08:35 +0000
committerschwarze <schwarze@openbsd.org>2018-12-16 13:08:35 +0000
commit7a804a675ee15157e1753459e2c2dd6aa1e4052c (patch)
treed3479e983899658d6025759bde674e4d9c1b40cd
parentRegenerate root CA list using updated format-pem.pl. Specifically this (diff)
downloadwireguard-openbsd-7a804a675ee15157e1753459e2c2dd6aa1e4052c.tar.xz
wireguard-openbsd-7a804a675ee15157e1753459e2c2dd6aa1e4052c.zip
Tweak the syntax displays to show that the list of words
in "for name in [word ...]; do list; done" can be empty. In sh(1), clarify what happens in that case. In ksh(1), clarify how it can happen that the list is never executed. OK jmc@ tb@
-rw-r--r--bin/ksh/ksh.112
-rw-r--r--bin/ksh/sh.112
2 files changed, 13 insertions, 11 deletions
diff --git a/bin/ksh/ksh.1 b/bin/ksh/ksh.1
index 5dcefe1d456..3db9a930947 100644
--- a/bin/ksh/ksh.1
+++ b/bin/ksh/ksh.1
@@ -1,8 +1,8 @@
-.\" $OpenBSD: ksh.1,v 1.201 2018/06/18 17:03:58 millert Exp $
+.\" $OpenBSD: ksh.1,v 1.202 2018/12/16 13:08:35 schwarze Exp $
.\"
.\" Public Domain
.\"
-.Dd $Mdocdate: June 18 2018 $
+.Dd $Mdocdate: December 16 2018 $
.Dt KSH 1
.Os
.Sh NAME
@@ -540,7 +540,7 @@ if no
.Ar list
is executed, the exit status is zero.
.It Xo Ic for Ar name
-.Oo Cm in Ar word No ... Oc ;
+.Op Cm in Op Ar word ... ;
.Cm do Ar list ; Cm done
.Xc
For each
@@ -564,10 +564,10 @@ e.g.\&
The exit status of a
.Ic for
statement is the last exit status of
-.Ar list ;
-if
+.Ar list .
+If there are no items,
.Ar list
-is never executed, the exit status is zero.
+is not executed and the exit status is zero.
.It Xo Ic if Ar list ;
.Cm then Ar list ;
.Oo Cm elif Ar list ;
diff --git a/bin/ksh/sh.1 b/bin/ksh/sh.1
index 76b09be882b..4f537230311 100644
--- a/bin/ksh/sh.1
+++ b/bin/ksh/sh.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sh.1,v 1.150 2018/11/30 08:55:57 solene Exp $
+.\" $OpenBSD: sh.1,v 1.151 2018/12/16 13:08:35 schwarze Exp $
.\"
.\" Copyright (c) 2015 Jason McIntyre <jmc@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: November 30 2018 $
+.Dd $Mdocdate: December 16 2018 $
.Dt SH 1
.Os
.Sh NAME
@@ -1755,7 +1755,7 @@ A
executes a series of commands for each item in a list.
Its format is:
.Bd -unfilled -offset indent
-.No for Ar name Op in Ar word ...
+.No for Ar name Op in Op Ar word ...
do
.No " " Ar command
.No " " Ar ...
@@ -1773,8 +1773,10 @@ The construct
.Qq in word ...
can be omitted,
which is equivalent to: in \&"$@\&".
-The exit status is zero if there are no items
-or otherwise the exit status of the last command executed.
+The exit status is that of the last command executed.
+If there are no items,
+.Ar command
+is not executed and the exit status is zero.
.Pp
A
.Em while loop