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 69FCF216DC for ; Mon, 1 Apr 2024 16:24:20 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1711981460; b=ggM04F4VUwaUMvOiaNFMoV1vqSmZe2Bfe6rSc4OkeCKnW1Ru+g6oZlauWOt3UYTKb5WTXcNRG8 uGVNMqvtbQ7AOId9AQZPMupPgmEI/LXngNgEHQORQ2e8Sh4uq9sHak3vY8sXlhs76xzL77sYvE tPvPbYqyoQxxGUPOKW8n2AoL13y55lpXEBdQOgE02KcW4t/252KPcTzNWRT5PekLihJfW7RlsJ hIGza+A0Gz1Z8Q1do6WnnmsbPg64cpC0FUDbFvO3PMIf9xpZPmU5NeQWAutnDwL70OPXhd3iSf MrC3VKL2V0hIiUPh8bJiAMOMJb3s3zq8AeQwsaasmCg0Ag==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta02.eastlink.ca) smtp.remote-ip=24.224.136.13; 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=1711981460; bh=qmtITlmTfhmQZiwjcRkAXvf17L8sVjLt2GQIEu3DVaE=; 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=DC3oIQ6+EhwSD1v8r2tXGt9RRpOKU+xmqaNnnRQAXF1UpQ6p/GsyeY4PoIucH6FcW3at4gsqcM 7fQkEDTXgdBNOH/gMLH4mpFChzQ0igBMi29gQABSMJ967xxXggmMwNl0qYove8uSkfOsoWQ4PM KVNB1QLRCAm7I7V50oF1ifdeA2VJoLoWyVwMI0CVQz6x11dO/aminVk8FPtD3piPvNWTR8vKKN 4nGoRSqBFvHA7ZmxIThErcdloEnOVMwCzwbueIXXKpRfOwwUYwT4/hs3/ulgnDVZ6qt+qM5HZG 3GjZmMstOPdSUCcifsUdvpGY6LZcLZJypDqZsMkC5Bo1qA==; 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=N+ytFhvgDgdA4e89mZ7QYwsuEs1qiq3yvNPp2dm1RGs=; b=UfC64qaTxWfbhdBK9qZ3AUtziX 2S4YLq8+5oq0sLNZXSUywSCdwZvwQ4UvFIKlOOOHgcTWexjTZIIUOI9LJ52cxFis2eW3J+KmYN5+S HgJ4iF+D94oTyQvySrcxjCkYV9UGamO7fsX5BQWIL4FWcy2FC7NrahEcjDNnqVlEtZpI/8rd0TeP3 Us8DSZNU/WxopcVn6HcJIW3a98+VDIPnaXx07OtwnXlQASE9O/GuCXGMlqBSW2WbUKWgz5xhsze35 VOmHT/S1cloYL94tjbdW+HZQHVgS25iis9NRsKVoTggXIQJ7rEEan5rGpb8A0M2xUb8QCOZaK46PO 1ZQdS2EQ==; Received: by zero.zsh.org with local id 1rrIaC-0007GU-R3; Mon, 01 Apr 2024 14:24:20 +0000 Authentication-Results: zsh.org; iprev=pass (mta02.eastlink.ca) smtp.remote-ip=24.224.136.13; dmarc=none header.from=eastlink.ca; arc=none Received: from mta02.eastlink.ca ([24.224.136.13]:43629) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rrIZl-0006bW-1e; Mon, 01 Apr 2024 14:23:53 +0000 Received: from csp01.eastlink.ca ([71.7.199.166]) by mta02.eastlink.ca ([24.224.136.13]) with ESMTPS id <0SB901O8SPBLDVF0@mta02.eastlink.ca> for zsh-users@zsh.org; Mon, 01 Apr 2024 11:23:52 -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 rIZjr0FN8AimnrIZjruCig (version=TLSv1_2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256); Mon, 01 Apr 2024 11:23:52 -0300 X-Authority-Analysis: v=2.4 cv=Q8Rx4J2a c=1 sm=1 tr=0 ts=660ac378 a=e7T7DzMKK1R988ZCg0wLyw==:117 a=e7T7DzMKK1R988ZCg0wLyw==:17 a=r77TgQKjGQsHNAKrUKIA:9 a=Jf_VJJE2zjoETfdk90kA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=pGLkceISAAAA:8 a=H0GVkxAV9t7A0KJtoM0A:9 a=hfza_784xXUBUilr:21 a=_W_S_7VecoQA:10 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudeftddgjeejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecugfetuffvnffkpffmpdfqfgfvnecuuegrihhlohhuthemuceftddtnecunecujfgurheptgfkffggfgfuvfhfhfgjsegrtderredtvdejnecuhfhrohhmpeftrgihucetnhgurhgvfihsuceorhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrqeenucggtffrrghtthgvrhhnpefhteethfevgeeuvdelgefgvdevudefueduffdvgfelvddvgfdtieegueeuleeifeenucfkphepvdegrddvtdejrdduledrudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvdegrddvtdejrdduledrudefpdhhvghloheplgduledvrdduieekrddtrdduudgnpdhmrghilhhfrhhomheprhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrpdhnsggprhgtphhtthhopedvpdhrtghpthhtohepreerpdhrtghpthhtohepiihshhdquhhsvghrshesiihshhdrohhrghdpghgvthdqkghiphfrrghsshifugepthhruhgv X-Vade-Score: 0 X-Vade-State: 0 X-EL-AUTH: rayandrews@eastlink.ca Content-type: multipart/alternative; boundary="------------kyTohgxQQm7FmBf6Tf0k066J" Message-id: <79297a84-0576-4cd7-ab52-5ceec954e600@eastlink.ca> Date: Mon, 1 Apr 2024 07:23:51 -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: 29749 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. --------------kyTohgxQQm7FmBf6Tf0k066J Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024-04-01 06:54, Mark J. Reed wrote: > I haven't read your whole message yet, but to unshift a new value in > front of the positional params, all you have to do is this: > > >     set -- "$new" "$@" > > And now $1 is "$new", $2 is whatever $1 used to be, and so on. > ... ah, I see, you want to just /undo/ a shift. Well, AFAIK you can't do that without manually saving the value that was in $1 before the shift somewhere. Then you can use *set *to put it back. No problemo.  saving the previous '$1' is no issue, I can hardly expect it to be saved somewhere automatically, that would be a courtesy hardly of much use and not worth the bother.  The 'set' trick above is exactly perfect. Thanks Mark. --------------kyTohgxQQm7FmBf6Tf0k066J Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
On 2024-04-01 06:54, Mark J. Reed wrote:
I haven't read your whole message yet, but to unshift a new value in front of the positional params, all you have to do is this:


    set -- "$new" "$@"

And now $1 is "$new", $2 is whatever $1 used to be, and so on.

... ah, I see, you want to just undo a shift. Well, AFAIK you can't do that without manually saving the value that was in $1 before the shift somewhere. Then you can use set to put it back.

No problemo.  saving the previous '$1' is no issue, I can hardly expect it to be saved somewhere automatically, that would be a courtesy hardly of much use and not worth the bother.  The 'set' trick above is exactly perfect. 

Thanks Mark.
--------------kyTohgxQQm7FmBf6Tf0k066J--