From nobody Sat Sep 12 15:01:18 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hhvkR0FkYz6sJdy for ; Sat, 12 Sep 2026 15:01:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hhvkQ6k42z4LYV for ; Sat, 12 Sep 2026 15:01:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789225278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ar7rFbRjzJdOMy/kOA/TJcaIzBBGHJZ1YAVhD5vBHMc=; b=liF9FhAUv8RI3xpv+oq0Hdcdy8dESiVmJot6wE2ngBt7cJk8NfUqjjfzNK1gYLYYOjjx4h oVXnIE2S8zZbsJgfgRUDrtz5V7eYHYkeFwGV4e/Dfbfw/59mEw4sdtrEO/MmYU/HCArJvH qxQlo9SvkveNKVjwvFv2EyAptB2TFnn7ktC8BDLFAJgdWvglCnAGPibmTFx3Fsxtt+i+xx HokuKndwZfjQVtQjRGE+U5dU3k5R42Fh23neXUHFd5hcBa8W/0YArJaIzQrRSO8qv5sNHo uOjgEjDRk13BM/Kgxe61FcTbDSGf5p9Cy4RRd4tYh1H1k01dlnLlfwzkqeIDTQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1789225278; b=sNommgq2HcKGO4QPqStlOYUExWOwiVIQZDJZ0tDs3Ywx7T4pzzXtueJi0iIlcRzL3Ovp2s IgGjfpbxTsmDLuEXM0HmvkMghPcH9XzbqID4GWnmEwx0bb0pVnT7GaL2I6cVgjwIvtmd8Z J8FAnIB4U7or8OcYNUrusJa41RPgDoNJdSulmWKJWRJI4Gl9aL3dLel5aigPaEpXQ1PVNE RrNlzeK85/RGR7R6GNH9MxIXjuSXXMToYeZgs2dOIAwWn0rHIeZLpfOwrL4jajVulIDHyj KsUtKxINY0MEeT2oaKGs1CmY2OMaKgNQ+4F6gO8a0pv6dOrmvm/rS9ZG1pokyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789225278; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ar7rFbRjzJdOMy/kOA/TJcaIzBBGHJZ1YAVhD5vBHMc=; b=q4ECtB4DhxD5QGLwI6p2TbEGkCH8d3336F4GG6wfyWzA6JGwrSRmR93O5DrJ1KdvNQc0JO oaJX93RRV+AQBQj0xronNAR/MzpJM8AlY759dRrgBg+G2Ea1fqM2GH0vj4iWt2ZHOlRQ5o 0slJZnG59FiGVEgCWeh0zF0Ey0GHZAfPZHagVvzqQjTxPEe+CusEoUzgrrGShyGyGYDBvZ qsCxKsUU7fL7Ji8vBKNEOB9ki2tco4rV49tY8QMsxcAE8943vHx7GLCw/yqJV21oRrp10l ZSVBUmvQIu7K2QmZ+wMjxhf5gfI2QsZIXRMpoodLvXJ8BwGFMGgnlJcsNzfGlw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hhvkQ5mgTz13TF for ; Sat, 12 Sep 2026 15:01:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 32774 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 12 Sep 2026 15:01:18 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Ziaee Subject: git: 35973eceff09 - main - sh.1: Renew description of case List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ziaee X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 35973eceff091275d8692283ae3a1256a6317525 Auto-Submitted: auto-generated Date: Sat, 12 Sep 2026 15:01:18 +0000 Message-Id: <6aa5693e.32774.1a994d38@gitrepo.freebsd.org> The branch main has been updated by ziaee: URL: https://cgit.FreeBSD.org/src/commit/?id=35973eceff091275d8692283ae3a1256a6317525 commit 35973eceff091275d8692283ae3a1256a6317525 Author: Alexander Ziaee AuthorDate: 2026-09-12 14:44:34 +0000 Commit: Alexander Ziaee CommitDate: 2026-09-12 14:44:39 +0000 sh.1: Renew description of case Update case synopsis, split description into paragraphs, improve markup, light wordsmithing, and import exit status line from NetBSD. While here, remove the '-' from the beginning of this document. PR: 298329 Event: EuroBSDcon 2026 Fixes: c9afaa63894e ("Add case statement fallthrough") Fixes: f7a9b7fe3a8d ("Allow a left parenthesis before patterns in case blocks") Fixes: e00e16ad7f86 ("Allow empty case/esac statements") MFC after: 3 days Reviewed by: bcr, jilles, Artem Bunichev Differential Revision: https://reviews.freebsd.org/D59518 --- bin/sh/sh.1 | 54 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/bin/sh/sh.1 b/bin/sh/sh.1 index 927ed666b440..cf81887247ca 100644 --- a/bin/sh/sh.1 +++ b/bin/sh/sh.1 @@ -1,4 +1,4 @@ -.\"- +.\" .\" SPDX-License-Identifier: BSD-3-Clause .\" .\" Copyright (c) 1991, 1993 @@ -41,7 +41,7 @@ .\" the referee document. The original Standard can be obtained online at .\" http://www.opengroup.org/unix/online.html. .\" -.Dd July 19, 2026 +.Dd September 11, 2026 .Dt SH 1 .Os .Sh NAME @@ -1077,12 +1077,15 @@ The syntax of the command is: .Bd -unfilled -offset indent -compact .Ic case Ar word Ic in -.Ar pattern ) Ar list Li ;; +.Oo Cm ( Oc Ar pattern Cm ) Oo Ar list Oc Cm ;& +.Oo Cm ( Oc Ar pattern Cm ) Oo Ar list Oc Cm ;; .Ar ... .Ic esac .Ed .Pp -The pattern can actually be one or more patterns +The +.Ar pattern +can be one or more patterns (see .Sx Shell Patterns described later), @@ -1090,23 +1093,40 @@ separated by .Ql \&| characters. Tilde expansion, parameter expansion, command substitution, -arithmetic expansion and quote removal are applied to the word. -Then, each pattern is expanded in turn using tilde expansion, -parameter expansion, command substitution and arithmetic expansion and -the expanded form of the word is checked against it. -If a match is found, the corresponding list is executed. -If the selected list is terminated by the control operator -.Ql ;& +arithmetic expansion and quote removal are applied to the +.Ar word . +Then, each +.Ar pattern +is expanded in turn using tilde expansion, parameter expansion, +command substitution, and arithmetic expansion and +the expanded form of the +.Ar word +is checked against it. +.Pp +If a match is found, the corresponding +.Ar list , +if any, is executed. +If the selected +.Ar list +is terminated by the control operator +.Ql Cm ;& instead of -.Ql ;; , -execution continues with the next list, -continuing until a list terminated with -.Ql ;; +.Ql Cm ;; , +execution continues with the next +.Ar list , +continuing until a +.Ar list +terminated with +.Ql Cm ;; or the end of the .Ic case command. -.Ic case -fallthrough is specified by POSIX, but in practice is not entirely portable. +The control operator +.Ql Cm ;& +is specified by POSIX, but in practice is not entirely portable. +.Pp +The exit status is that of the last command executed +from the last list evaluated, if any, or zero otherwise. .Ss Grouping Commands Together Commands may be grouped by writing either .Sm off