Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: 5.3.1-dev-0 difference in array=( "${(PA@)var_name}" )
- X-seq: zsh-workers 41292
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Sebastian Gniazdowski <psprint@xxxxxxxxxxx>
- Subject: Re: 5.3.1-dev-0 difference in array=( "${(PA@)var_name}" )
- Date: Wed, 14 Jun 2017 13:35:47 -0700
- Cc: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=CbyI0L3CBNbzBM00o1a9nooct0Xyfp272zDb9Unwq14=; b=cg0H7IzCTWE2WKclmVRCwXQcBbohb8MVrstYtzl6cMIcNiDSjrNcoYp1RvuActKLs/ ykOXtx2D09rHs9967LfhgNVJYq8+Kd7gIlI19Uja9pHJE4PXqlt4sL9vXR7BcQcuawcY iKUavvad8ZpXgOi3CmFuUHz/Cs67zEzmB52wQsgabRTLfY/A+TRFXBEYq+a0P3vvQp00 BFVp08Etplm8Pw3ZXVz3HEs9STHHat7YJhqsDAG33HcAWI+VprH3rpTdN/N1bJqf+f7v hpF5913EuJngyeM4lug8/VfttQ5xn9rkIVUwNjvHFdJf8zKPb5nKx66t60TS/HfKNYgH rHNQ==
- In-reply-to: <etPan.59416db1.2eb141f2.8fd5@MacMini.local>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <etPan.59416db1.2eb141f2.8fd5@MacMini.local>
On Wed, Jun 14, 2017 at 10:09 AM, Sebastian Gniazdowski
<psprint@xxxxxxxxxxx> wrote:
> Hello,
> % zsh-5.3.1
> % var_name="abcdef"; array=( "${(PA@)var_name}" ); echo ${#array}
> 1
The (A) flag doesn't mean anything in this context in 5.3.1, that was
added about 2 months after the 5.3.1 release.
So in the above example ${(P)var_name} returns a scalar and the (@)
flag is also meaningless. In this next example --
> % zsh-5.3.1-dev-0
> % var_name="abcdef"; array=( "${(PA@)var_name}" ); echo ${#array}
> 0
-- the (A) flag does apply , so ${(PA)var_name} is an empty array
rather than an unset scalar, and (@) causes the double-quotes to
resolve to nothing rather than to a quoted empty string, just as
"${emptyarray[@]}" would do.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author