zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Mikael Magnusson <mikachu@gmail.com>
Cc: Peter Stephenson <p.w.stephenson@ntlworld.com>,
	Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: "${*:offset:length}" and ksh93/bash compatibility
Date: Sun, 13 Mar 2022 11:21:46 -0700	[thread overview]
Message-ID: <CAH+w=7aa8J9pTcBcTYqkHPx_2Z+GP8oUHXLyJt1FJ2nwsmzwTw@mail.gmail.com> (raw)
In-Reply-To: <CAHYJk3TTtr_4ib5rebTb+XicG1s0oEKcz8wAKdOcD2ztdOy8Xg@mail.gmail.com>

Arriving to this a bit late, have been traveling.

On Sun, Mar 13, 2022 at 8:22 AM Mikael Magnusson <mikachu@gmail.com> wrote:
>
> zsh% a=(one two three); echo "${a[*]:0:2}"
> on
> zsh% bash -c 'a=(one two three); echo "${a[*]:0:2}"'
> one two

The [*] subscript in double quotes has always been treated differently
in zsh.  You need [@] or the (@) modifier to preserve array-ness.  I'm
not sure the presence of the :off:len suffix should change that as a
side-effect, at least not in native zsh mode ... and it might be
difficult to "notice" the suffix early enough in the expansion code to
cause that effect anyway.  Particularly without also having the effect
that the end result is not joined into a single string.


  reply	other threads:[~2022-03-13 18:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10  7:50 Stephane Chazelas
2022-03-10 12:48 ` Mikael Magnusson
2022-03-10 14:25   ` Peter Stephenson
2022-03-13 15:22     ` Mikael Magnusson
2022-03-13 18:21       ` Bart Schaefer [this message]
2022-03-13 19:23         ` Mikael Magnusson
2022-03-13 20:57           ` Bart Schaefer
2022-03-16  5:57       ` Jun T
2022-03-16 15:57         ` Mikael Magnusson
2022-03-23  8:08         ` Jun T
2022-03-23 10:23           ` Mikael Magnusson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7aa8J9pTcBcTYqkHPx_2Z+GP8oUHXLyJt1FJ2nwsmzwTw@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=mikachu@gmail.com \
    --cc=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).