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 855E4208F9 for ; Mon, 1 Apr 2024 18:31:21 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1711989081; b=ei5ZvPtyU6VXnZh4KfWAsqzARuML7V3e2IitQQnUDwhUVlb0KtFjU7NtiXWNRbgscwsPcTDooV 5//zvpXk9pTOhTyN+n1KsgJ7fbOnPxjfQL5JpbljxpDGPl6i1zZ0hS0KbuUSW/7hFl6BMaPCZe jWK+9Xs7WH8iofd1QhYL/inVqD2cqy3ljeOZn+7C85n+IRQVXZRolyEbwjFVEm69WyqoV+ZMUj sy6zW9xeEGDbMDa4LfDRAWOmMUuS+w6HmRBR36/AuOT6TkTtKAIMxBkCjgZQ8SnhJOxoFWYmgZ WWwE+uvS9FzyXOtseNJmI307opBqKq36nq+RBfWEfSHQVg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta04.eastlink.ca) smtp.remote-ip=24.224.136.10; 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=1711989081; bh=2/iJr0juCxMd2dfj3XD7Zl2jOrZJYGOz8dAIvwScyzM=; 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=QpBknAHJ1yxnE7r5hIhBfR2wcvYtNQFNoYR9W1aE4jT00xn5R0EEYxu0/zXgxgOt9pztJFgO3q mPnol8beYvv32oEhLxa5wa7D7ViyHIkg+PN+apGSCbHJ48ahYF7SaD3noCMPZzUPB9L/SHe6HA cnhYxUzxQK/OzX73wVhxQPKN2m7T4Mh33ySEioV4dkuxINF+z7KAd1Y3dcL+nOhvGwn1VKbOzM 0oWhF0Z5BP96QGweN7sk2cImAMnaYy4kUAvTOB831OPZE6uU9n+lDGGBTwC7kEr/VXXp8rna+4 o8aNtgMBVqyoL5vxyFMLscqH2+Tqgn7QpYLzT7+d4RGmew==; 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=9HvULCX0vOV0ecYR4Y+NwTIW9TTl4xZUO/2IC2ocZUw=; b=SmW54r9jjZ5YcZdGfi7au7ei6p gr9YdzRg+k6df9IcUoyp+XQcJyufPp5CE6oWgaEYhpmY4w7fdBcDr7F+s73N85P/b1/tXeKGUrUw3 gD2oSOki3lFk1ydjk5q1YZzN5NPCeIvq4mLxJ5KejhdNZkaFr/O74RN+Ff/fb7L7RlKRdGncssVY5 88OHuK0A7AMZl9t4H++goTo+AJme1IFYOPaHav6FUY8+e3bkn1KJ5QSLnj8CERA8N6oZJdRxGrPNr ED7EAv3dZSU7TBZsesjGRuEzotnyNq/V28DO4g4Qr/54WDIB209gUwL+lG9CuRuUg28jBL+tCjuqP 5Ul1eO+g==; Received: by zero.zsh.org with local id 1rrKZ6-000H81-VV; Mon, 01 Apr 2024 16:31:20 +0000 Authentication-Results: zsh.org; iprev=pass (mta04.eastlink.ca) smtp.remote-ip=24.224.136.10; dmarc=none header.from=eastlink.ca; arc=none Received: from mta04.eastlink.ca ([24.224.136.10]:44941) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rrKYa-000GQ6-03; Mon, 01 Apr 2024 16:30:48 +0000 Received: from csp01.eastlink.ca ([71.7.199.166]) by mta04.eastlink.ca ([24.224.136.10]) with ESMTPS id <0SB902266V75UAR0@mta04.eastlink.ca> for zsh-users@zsh.org; Mon, 01 Apr 2024 13:30:47 -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 rKYYr0XDyAimnrKYYruHhl (version=TLSv1_2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256); Mon, 01 Apr 2024 13:30:47 -0300 X-Authority-Analysis: v=2.4 cv=Q8Rx4J2a c=1 sm=1 tr=0 ts=660ae137 a=e7T7DzMKK1R988ZCg0wLyw==:117 a=e7T7DzMKK1R988ZCg0wLyw==:17 a=r77TgQKjGQsHNAKrUKIA:9 a=bf79uf4vKeiWjxwcalIA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=pGLkceISAAAA:8 a=y83o7WtROBD2c7Y8R-YA:9 a=_W_S_7VecoQA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudeftddguddtvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfgtefuvffnkffpmfdpqfgfvfenuceurghilhhouhhtmecufedttdenucenucfjughrpegtkfffgggfuffvfhfhjgesrgdtreertddvjeenucfhrhhomheptfgrhicutehnughrvgifshcuoehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgeqnecuggftrfgrthhtvghrnhephfettefhveeguedvleeggfdvvedufeeuudffvdfgledvvdfgtdeigeeuueelieefnecukfhppedvgedrvddtjedrudelrddufeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvgedrvddtjedrudelrddufedphhgvlhhopegludelvddrudeikedrtddruddungdpmhgrihhlfhhrohhmpehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgdpnhgspghrtghpthhtohepvddprhgtphhtthhopeerredprhgtphhtthhopeiishhhqdhushgvrhhsseiishhhrdhorhhgpdhgvghtqdgkihhprfgrshhsfigupehtrhhuvg X-Vade-Score: 0 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Content-type: multipart/alternative; boundary="------------0NY3NvfZtsKceYaBYPmY7xpG" Message-id: <70130b1b-696b-4a33-afb4-be96ae60d592@eastlink.ca> Date: Mon, 1 Apr 2024 09:30:45 -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: 29755 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. --------------0NY3NvfZtsKceYaBYPmY7xpG Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024-04-01 09:03, Bart Schaefer wrote: > shift > while [ "$1" ]; do > repeat 1 do > if [ a ]; then b; c; break; fi > if [ d ]; then e; f; break; fi > if [ g ]; then h; i; break; fi > ... > done > shift > done > Ah!  So a 'break' quits the inner loop then hits the 'shift' which has the same effect as putting the shift at the top of the outer loop.  That's very clever.  Never seen 'repeat' used in a real life way.  There are tools which aren't used often, but still very useful when needed. --------------0NY3NvfZtsKceYaBYPmY7xpG Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

On 2024-04-01 09:03, Bart Schaefer wrote:
shift
while [ "$1" ]; do
  repeat 1 do
    if [ a ]; then b; c; break; fi
    if [ d ]; then e; f; break; fi
    if [ g ]; then h; i; break; fi
    ...
  done
  shift
done

Ah!  So a 'break' quits the inner loop then hits the 'shift' which has the same effect as putting the shift at the top of the outer loop.  That's very clever.  Never seen 'repeat' used in a real life way.  There are tools which aren't used often, but still very useful when needed.
--------------0NY3NvfZtsKceYaBYPmY7xpG--