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,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 10465 invoked from network); 13 Mar 2022 15:22:27 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 13 Mar 2022 15:22:27 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1647184947; b=ewAWqbZ4PblJpAWHez5CSp5mH4KUHHng1Rh0s0bXTf12IYUXOVOl73x3jkC17exBm2nXrxOOkB Fu/VPAXQzbTQwBShB07JeMTUzxPCvwBuGeVnlRs6nOhV0ubtp4IBkGTDJTm4lhtkIvABxCdfTk K6Ro+G6P+633fDbflh72kfOsKOrbguVODfVrgSh9Pqjgeoc7h5jI9hM116578poYAb8IxJxs6Z WmmyrD+70ogvWAcG+Aj8oZ7DjwFBwI0pgGmbZNIr0K+GJpQSo3OUTcvC6rchoI8Z0x094/pthl t4+jWPjm0KG1ASu2fwgXwK1hOggNDnWLWIuGYKgKWrHiZQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-pj1-f49.google.com) smtp.remote-ip=209.85.216.49; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1647184947; bh=BezOmtArEmA6PHNSPqT/OB4dtNolPEHO1OypNIhKkZ4=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:References:In-Reply-To:MIME-Version:DKIM-Signature: DKIM-Signature; b=ewgNa4emoo8/KVQoUE00dJK50PWpllC/IrBjlytSncOa/Nzx0y8tBSrYXklhVYpuKGp7w+uTpi LDef8sIngU7Rh8XzXm8CRKo6P4efj5Rc1jQKC0hJppzDSV5ddwBqvq+7r/bQJeL/rSqodS//S8 HD1VPRUJ1MYoh6tUgAPaDitIsXMio3Z+Y8zt2NfKy+SKGxD6NdkUEluvLH8qPiHzc7OfL95GDn cb70SHyc+Q13Wwr3I0WUJ7v0jY2Vry+NStcUWarQLb3UeU1hx0ZE4sN2X1Rls8buG7DZ+qxclk U28RZuqo5SH1z7HwBZ+/VeVtIoXDWkY/Rs81I2rX3Voobw==; 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:Cc:To:Subject:Message-ID:Date:From:References:In-Reply-To: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=CyjrChGZczQxXHfUnQ7xKu+1Yhx+9/gz5jmp2Ii8Py0=; b=Iz5XJnuurdPsETzs8GL+epw29S DwKVYCOg4tkWGK8VmDuL+86LatHBq9+zcIAc0qRiRg6U69Ufmyz1iklBY0kaSwCGQE1eSbVCY9gui lIYXcBHyHjbcDEhqueP6rTpDjsGrImEAQ6v6M4/4bOJq59DlmPYVIm66h7iW6EIutMpmQ/EFkazKu H9Ar5oBMIWhcEniGR/2X3y3/fH5bjFlBn2m8lnKas70PVnAYNbuvFwIzHf65osPPu48nCDbfZf4T3 R86hcxSwuPCWtSnEQYmFsRNKXz3hfUaJObwTSKtbMkjEHkJnGtSqbDLtCeheLZ6j0gthRi1yfom+R FImeusXQ==; Received: from authenticated user by zero.zsh.org with local id 1nTQ38-00034t-Mp; Sun, 13 Mar 2022 15:22:26 +0000 Authentication-Results: zsh.org; iprev=pass (mail-pj1-f49.google.com) smtp.remote-ip=209.85.216.49; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-pj1-f49.google.com ([209.85.216.49]:54109) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1nTQ2t-0002j7-IV; Sun, 13 Mar 2022 15:22:12 +0000 Received: by mail-pj1-f49.google.com with SMTP id bx5so12294893pjb.3 for ; Sun, 13 Mar 2022 08:22:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=CyjrChGZczQxXHfUnQ7xKu+1Yhx+9/gz5jmp2Ii8Py0=; b=M0Fhhankg0o5tcNuTtspWQP78SyOcak0Yy9LLqFTgYlYByO8QNZ6t5V39fcRuljHfd tTcYMhoj3DgSbxhAzhBYgHGDmheYcb/4rH5uf1lf4e2btYQ+Nnkicx1BLt297vWPO/HH OP1BnBzZQU7JizzmUV1OsGIR3yf6yclSMFGxhVekRv2S0HX09lJWWW5QGskyvNII+jDc aLRwqgsu2nr6b40tU/wlspBt7bbpGFYVbxUdeJKtDxTluGUVoUkYkw2BPjLq3A7H/Www j1DvgzounfFqfJxkJeTVAQS5QPMGw4EWu1Z6SgbpDBnCLUANYKjSJICpxBEnenvVk8HU 3XaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=CyjrChGZczQxXHfUnQ7xKu+1Yhx+9/gz5jmp2Ii8Py0=; b=0t8wAR+/sp2o10caUwPVi/sy1GXHp2O2+xxt6AX3OHmxCGSte1/p9DyAcAZvNQmyO2 e1a61EbjziQ5V3AtkSkM1HygbEw8gOHqVIDAjJNFyRYOyBSYinqM0zxLIWl6Q/pDiPbW tDrdq/MKyyZvNm9jsAcdaz4OO/GJf5vGOZY4hYKIwNdc/di+l54F5noZwXS6TBNBB+J5 /VcgnUrl1Dd4C0Ji3m+xuyOOp4fQzNQVgVd8JJNV02n4s1wlffO/7En6ooVWAljItH8Z MgmWLS86KvVH1PYwv6BWRKhuU4UgraYxLic+y9FT4AdBxINuSlfwJIRmVLE4ppXVm17S nBlA== X-Gm-Message-State: AOAM533TGjWBEFjnIoRKeuWPngMcdJdbAbQjMRL1NDS4mB3Iz6VBkfID irBBs0o+IUXJuUHJavDqigVpfq6jHTGFK9Nil0Q= X-Google-Smtp-Source: ABdhPJymmyf+dwR4eePoCg/2dXUKX5pC93Yi8KpTvE1EOMSBYklTcsMWu2cR/fA4owGw15+kkXtErRP1ilx2NOdUlH0= X-Received: by 2002:a17:90a:cce:b0:1bf:6387:30d9 with SMTP id 14-20020a17090a0cce00b001bf638730d9mr32123013pjt.196.1647184930152; Sun, 13 Mar 2022 08:22:10 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:6a10:466:0:0:0:0 with HTTP; Sun, 13 Mar 2022 08:22:09 -0700 (PDT) In-Reply-To: <7694652.296620.1646922350773@mail2.virginmedia.com> References: <20220310075026.ovwlhxq24cmda5s3@chazelas.org> <7694652.296620.1646922350773@mail2.virginmedia.com> From: Mikael Magnusson Date: Sun, 13 Mar 2022 16:22:09 +0100 Message-ID: Subject: Re: "${*:offset:length}" and ksh93/bash compatibility To: Peter Stephenson Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 49834 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On 3/10/22, Peter Stephenson wrote: > On 10 March 2022 at 12:48 Mikael Magnusson wrote: >> On 3/10/22, Stephane Chazelas wrote: >> > Should zsh align with bash/ksh there. >> >> If we do, it would probably look something like this (does not handle >> all cases), unless someone has a better idea... > > I think it should change --- the documentation is already clear this is > here to please users of other shells, not native zsh. Otherwise we end > up with what's (as we say where I come from) neither nowt nor something. > > This syntax gives effects similar to parameter subscripting in the > form > $name[start,end], but is compatible with other shells; note that both > off=E2=80=90 > set and length are interpreted differently from the components of a > sub=E2=80=90 > script. I realized that this is not limited to $*, zsh% a=3D(one two three); echo "${a[@]:0:2}" one two zsh% a=3D(one two three); echo "${a[*]:0:2}" on zsh% bash -c 'a=3D(one two three); echo "${a[@]:0:2}"' one two zsh% bash -c 'a=3D(one two three); echo "${a[*]:0:2}"' one two So perhaps this should be attacked in a different place/way than my test patch (though i think the horrible offset hack is still needed for $*:0 specifically (and i actually didn't even handle that in the patch anyway.).) --=20 Mikael Magnusson