From 6f7f17f793e3f999dab1535ebd387bdb7a9a38e4 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 16 Dec 2018 13:08:36 +0000 Subject: 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@ --- bin/ksh/sh.1 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'bin/ksh/sh.1') 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 .\" @@ -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 -- cgit v1.2.3