From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 4943 invoked from network); 22 Dec 2022 07:05:20 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 22 Dec 2022 07:05:20 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:Subject:To:From:Date:References:In-Reply-To:Message-Id: Mime-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=AJirvAwl6I43fvyn71ciTLMIgKuitYs1cdt12Q5EcbA=; b=ayombgzVQ5et9DacbfKBemmtTH p5GXjTVeDmBU5dXkCHOzl1Y0ZIZEVXRovUPlbfKtWC5798qgYkI5p9J/9eEzOpQFbIBPz7MoaRIV1 piKICKp24KrKaF2R1YbZyNvObz6NMMosPgl+zIJ/4FwQ2nyc/AszDzlrinuQ46RRlWIAhxEdLatcY cMg6N8u3STshnk5sLxvBnjEP0M4roXp6+NSTodw8bVTX6UyPJxALXpXiIeWvprAtFR1bL0WdtN6D+ CM2sb61+v4amyYTqWGe2lpc6zH3Wu7MFMXG3Nmtst3TTmndukft2C5q0A5MbEdyjlHQtWOcv0woun bz7OtiUw==; Received: by zero.zsh.org with local id 1p8Fdn-000FHQ-L3; Thu, 22 Dec 2022 07:05:19 +0000 Received: by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1p8Fc9-000Eac-Lb; Thu, 22 Dec 2022 07:03:37 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id BB36227C005A for ; Thu, 22 Dec 2022 02:03:36 -0500 (EST) Received: from imap48 ([10.202.2.98]) by compute1.internal (MEProxy); Thu, 22 Dec 2022 02:03:36 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrgeelgddutdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtgfesth hqredtreerjeenucfhrhhomhepnfgrfihrvghntggvucggvghljoiiqhhuvgiiuceolhgr rhhrhihvseiishhhrdhorhhgqeenucggtffrrghtthgvrhhnpeejgfetjeevteegjeejgf dvtdejtdethfejveevudelgfeffeetgeduheelffdtffenucffohhmrghinhepohhpvghn ghhrohhuphdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehlrghrrhihvhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidq udduhedukeejjedtgedqudduledvjeefkeehqdhlrghrrhihvheppeiishhhrdhorhhgse hfrghsthhmrghilhdrtghomh X-ME-Proxy: Feedback-ID: iaa214773:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 9887331A0063; Thu, 22 Dec 2022 02:03:36 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.7.0-alpha0-1185-g841157300a-fm-20221208.002-g84115730 Mime-Version: 1.0 Message-Id: In-Reply-To: <71c9c7e9-3f95-143d-fbd6-6575d7f4c446@eastlink.ca> References: <71c9c7e9-3f95-143d-fbd6-6575d7f4c446@eastlink.ca> Date: Thu, 22 Dec 2022 02:03:16 -0500 From: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= To: zsh-users@zsh.org Subject: Re: manual Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Seq: 28608 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On Tue, Dec 20, 2022, at 5:41 PM, Ray Andrews wrote: > Daniel was interested in what I'd do with the 'set' man page.=C2=A0 It= has a=20 > completely different flavor but: > > 'set' has too many uses: > > 1): set [+] > 2): set {+|-}s [STRING] [STRING] ... > 3): set {+|-}s -A [ARRAY_NAME] [VALUE] > 4): set=C2=A0 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 +A [ARRAY_NAME] [VALUE] =C2= =A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 # sorting not available=20 > with '+A' > 5): set {+|-}OPTION_NAME > 6): set +o > 7): set -o > 8): set {+|-}o [OPTION_NAME] [OPTION_NAME]=C2=A0 ... [--] Partitioning the synopsis isn't a bad idea, but your partition is misleading because most of the options you separated can actually be used together in a single "set" command. % print $options[ALIASES] $options[ERR_EXIT] on off % typeset -p argv typeset -a argv=3D( ) % set +o ALIASES -e foo bar baz % print $options[ALIASES] $options[ERR_EXIT] off on % typeset -p argv typeset -a argv=3D( foo bar baz ) % typeset -p arr || true typeset: no such variable: arr % set -o ALIASES +e -A arr v1 v2 v3 % print $options[ALIASES] $options[ERR_EXIT] on off % typeset -p arr typeset -a arr=3D( v1 v2 v3 ) POSIX.1-2017 does partition its synopsis [*], but later it has to explicitly explain that setting and unsetting attributes can be mixed in a single invocation because the synopsis implies otherwise. set [-abCefhmnuvx] [-o option] [argument...] set [+abCefhmnuvx] [+o option] [argument...] set -- [argument...] set -o set +o [*]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap0= 2.html#set > 2): set {+|-}s [STRING] [STRING] ... : The term "string" is next to useless when discussing shell. Almost everything is what you might consider a string. > If no flags other than +s or -s are given then the arguments following=20 > 'set' are assigned to the > positional parameters: As I already mentioned, this is incorrect. Options and positional parameters can be mixed in the same invocation. > 3): set {+|-}s -A [ARRAY_NAME] [VALUE]: > ARRAY_NAME is set to VALUE, completely erasing any former contents: > > 4): set +A [ARRAY_NAME] [VALUE]: > ARRAY_NAME is overwritten by the new VALUE but not truncated if the new > VALUE is shorter than the old. These are incorrect. Multiple arguments can be provided, all of which are assigned to the array. Additionally, -s and +s work with +A, and it is not clear what "value" is supposed to mean. > Note that 'typeset -A' is quite different from 'set -A'!=C2=A0 If you = are=20 > copying an > associative array to another array you must do this: > > $ typeset -A NEW_ARRAY > $ set -A NEW_ARRAY OLD_ARRAY This example incorrectly implies that this should work: % typeset -A old_arr=3D(a 1 b 2 c 3) % typeset -A new_arr % set -A new_arr old_arr zsh: bad set of key/value pairs for associative array > 5): set {+|-}[OPTION] > Turn on|off a single OPTION. This incorrectly implies that it is not possible to enable options, disable options, and set positional parameters in the same invocation. > 8): set {+|-}o [OPTION] [OPTION} ... [--] > Turn on|off the given OPTIONS.=C2=A0 If the list is followed by '--' t= he=20 > positional > parameters will be unset. It is not possible to enable or disable multiple options this way. All but the first will actually be used as positional parameters. % set -o EXTENDED_GLOB ERR_EXIT % print $options[EXTENDED_GLOB] $options[ERR_EXIT] on off % typeset -p argv typeset -a argv=3D( ERR_EXIT ) Additionally, this incorrectly implies that the positional parameters can only be cleared after -o or +o. > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 For historical reasons, `set -' is treated as `set +xv'=20 > and `set - args' as > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 `set +xv -- args' when in any other emulation mode than=20 > zsh's native mode. > > DON'T KNOW WHAT TO DO WITH THAT. Leave it in? --=20 vq