From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 0438C25259 for ; Tue, 2 Apr 2024 22:24:49 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1712089489; b=GyprHqRsgNNmALf2sp8C2lWM3zOGRZ+U2Ubx31KwRPDeetetkfgVxzCaDmFPNDiQz7cItOUM8L KidPaSQnHgxZadOuRDYy2uwRXKHClX1N4c5C+cq+UDsURfbCV1MqbmJqYIA/sHORPvQeNU4aNb f9/+haW5KO1p0ZPBeVn8UHF40MxPIrnorJT8UKhO3eVGBplw7r66+27SjT1OdPn0xAmW75391h lGbP7zc38onHTcXP2DwbIiELDcWv5Ro6h1n5MpybW/6+VAsvXbaoRDRn6MyQqeX9gVRPfv/+gW ObOKTywGs4MpmEXx4FJn5Hhy5wWy8FjPOre4Fkto3bwZzg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta01.eastlink.ca) smtp.remote-ip=24.224.136.30; dmarc=none header.from=eastlink.ca; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1712089489; bh=DpqnaMGKcC88cweVyMSrmoWnRfdtrl65QPAEPhNE9os=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:From:References:To:Subject:MIME-Version:Date: Message-ID:Content-Type:DKIM-Signature; b=ggl6RDmfnjHzNBkX3zlcVtf1bAcw0SBB0G2A82zQ7gCzETZ+gWj1o0T3QWuIf2677MFjoAIoLL VbSt8iXWb3f9BT7LCuNoOXyzgdgLuuXXChuJUopVkuW3QFXlwyw7AoAh/Alqj3p9ySkGxrLMot NeuUkBb6pgkkJxhfeA4AfdZAs7YSbJ7kMXsSBrBIxjXLM/vxLhHNyoSXGR5wqlQajZCaZ3IlOP VIe+rcUmBQjUfoomeoybWUrtvIjkun7sDX1nDAHjPa3tpwpfn/WEG9wtFvnkZga0CedTPvRceU VUwQ6slOmj8QpjtNcmzR/fh6jhheMNkRwkwIWphVfT0D0g==; 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:In-reply-to:From:References:To: Subject:MIME-version:Date:Message-id:Content-type:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=v0SfnQv7CMNH7DYToqvXn6wxDIlNHoU3/X4VdZH1IHM=; b=f55yo0q1grWP2whRM5jwXlQETZ E2xW3fFR94QhiHrtjyMAX+FGnnFoK6lHyypibVhw4Z7yxApwhgMFToXnZV7qtvsFtzygWS0hWz5wY YkbeF8Kw4xjqejjw39w/ip3OgDzVKKdTUagaT80f/6ph/COyiSAMd6/e6EfZ/EVH7/V0cap7t4Ej4 swIz5GeJxszjVrTnmZYSYjUN6CFwbHfu67tYQ3P6bJR19hzmMo1zzAJtg+we5ATt3md5TgMHzj0Fu UDb/RZ01iyGQyHv3v4npnLDLCLh67YgsVtdaimFlIIxp9bnbXegrOiPDyEaDPCyZyMpuq7KSLt9MM aWic+8dQ==; Received: by zero.zsh.org with local id 1rrkgb-0000Ei-1s; Tue, 02 Apr 2024 20:24:49 +0000 Authentication-Results: zsh.org; iprev=pass (mta01.eastlink.ca) smtp.remote-ip=24.224.136.30; dmarc=none header.from=eastlink.ca; arc=none Received: from mta01.eastlink.ca ([24.224.136.30]:46061) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rrkfu-000PYi-39; Tue, 02 Apr 2024 20:24:06 +0000 Received: from csp01.eastlink.ca ([71.7.199.166]) by mta01.eastlink.ca ([24.224.136.30]) with ESMTPS id <0SBC08L6V0GK1D31@mta01.eastlink.ca> for zsh-users@zsh.org; Tue, 02 Apr 2024 17:24:04 -0300 (ADT) Received: from [192.168.0.11] (host-24-207-19-13.public.eastlink.ca [24.207.19.13]) by csp01.eastlink.ca ([71.7.199.166]) with ESMTPSA id rkfsr4AxBAimnrkfsrv39f (version=TLSv1_2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256); Tue, 02 Apr 2024 17:24:04 -0300 X-Authority-Analysis: v=2.4 cv=Q8Rx4J2a c=1 sm=1 tr=0 ts=660c6964 a=e7T7DzMKK1R988ZCg0wLyw==:117 a=e7T7DzMKK1R988ZCg0wLyw==:17 a=r77TgQKjGQsHNAKrUKIA:9 a=gir0-LH0AAAA:8 a=U6n2owRhJ9qG0UpPINMA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=pGLkceISAAAA:8 a=RtPO86-hHujKMwAPpv0A:9 a=90zMyomneAEFrz1A:21 a=_W_S_7VecoQA:10 a=lqcHg5cX4UMA:10 a=aLewGyoHDmJ4ULJHWpSz:22 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudefvddgudeglecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfgtefuvffnkffpmfdpqfgfvfenuceurghilhhouhhtmecufedttdenucenucfjughrpegtkfffgggfuffvfhfhjgesrgdtreertddvjeenucfhrhhomheptfgrhicutehnughrvgifshcuoehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgeqnecuggftrfgrthhtvghrnhephfettefhveeguedvleeggfdvvedufeeuudffvdfgledvvdfgtdeigeeuueelieefnecukfhppedvgedrvddtjedrudelrddufeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvgedrvddtjedrudelrddufedphhgvlhhopegludelvddrudeikedrtddruddungdpmhgrihhlfhhrohhmpehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgdpnhgspghrtghpthhtohepvddprhgtphhtthhopeerredprhgtphhtthhopeiishhhqdhushgvrhhsseiishhhrdhorhhgpdhgvghtqdgkihhprfgrshhsfigupehtrhhuvg X-Vade-Score: 0 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Content-type: multipart/alternative; boundary="------------5gfOV0RCNCivPJMRk8p0j2rp" Message-id: <5ea19f5d-5808-4850-92bd-5e928a5f2096@eastlink.ca> Date: Tue, 2 Apr 2024 13:24:03 -0700 MIME-version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: unshift To: zsh-users@zsh.org References: Content-language: en-US From: Ray Andrews In-reply-to: X-Seq: 29766 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: This is a multi-part message in MIME format. --------------5gfOV0RCNCivPJMRk8p0j2rp Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024-04-02 12:59, Roman Perepelitsa wrote: > On Tue, Apr 2, 2024 at 4:03 PM Ray Andrews wrote: >> while [ "$2" ]; do >> shift >> if [ a ]; then b; c; continue fi >> if [ d ]; then e; f; continue fi >> code-applies-to-all-below; more(of-the-same) >> if [ g ]; then h; i; continue fi >> if [ j ]; then k; l; continue fi >> done >> >> ... so elif won't work. > It'll work with one `else` in the mix. > > Roman. I'm happy with it as it is now, it seems clean.  I've always tended to be a good Protestant and do: ... shift ... ... while [ $1 ] ... ... get the shifting done ASAP, but the more I think about it the more I like: ... while [ $2 ]     shift ... ... more Catholic ... do it when you need to do it.   The function is quite a bit simpler that way.  Cross bridges when I get to them. --------------5gfOV0RCNCivPJMRk8p0j2rp Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

On 2024-04-02 12:59, Roman Perepelitsa wrote:
On Tue, Apr 2, 2024 at 4:03 PM Ray Andrews <rayandrews@eastlink.ca> wrote:
while [ "$2" ]; do
     shift
     if [ a ]; then b; c; continue fi
     if [ d ]; then e; f; continue fi
     code-applies-to-all-below; more(of-the-same)
     if [ g ]; then h; i; continue fi
     if [ j ]; then k; l; continue fi
done

... so elif won't work.
It'll work with one `else` in the mix.

Roman.
I'm happy with it as it is now, it seems clean.  I've always tended to be a good Protestant and do:

...
shift
...
...
while [ $1 ]
...

... get the shifting done ASAP, but the more I think about it the more I like:
...
while [ $2 ]
    shift
...
... more Catholic ... do it when you need to do it.   The function is quite a bit simpler that way.  Cross bridges when I get to them.



--------------5gfOV0RCNCivPJMRk8p0j2rp--