From: "Lawrence Velázquez" <larryv@zsh.org>
To: "Ray Andrews" <rayandrews@eastlink.ca>
Cc: zsh-users@zsh.org
Subject: Re: can print but not assign to variable
Date: Wed, 26 Oct 2022 18:19:08 -0400 [thread overview]
Message-ID: <eebfb68f-9e06-4b51-9113-a883fbee7bc6@app.fastmail.com> (raw)
In-Reply-To: <8276c2d0-5824-c02e-d493-b801b2b4a225@eastlink.ca>
On Wed, Oct 26, 2022, at 6:07 PM, Ray Andrews wrote:
> Ah! Yes, I do know that. Yes, we must force 'var' to become an array.
> Stupid ... when I'm doing it with understanding, I get "( )" just fine,
> but when I don't get the necessity I'm lost :( Ok, all clear.
Additionally, your original attempt -- var=(#i)$W/rap -- is not
actually parsed as a plain old scalar assignment, but as a command
preceded by a temporary array assignment. Here is a simpler
demonstration:
% unsetopt EXTENDED_GLOB
% fn() { typeset -p var }
% cmd=fn
% var=(#i)$cmd
typeset -g -a var=( '#i' )
With EXTENDED_GLOB enabled, "#i" is treated as a glob, but this
fails because it is an invalid pattern.
% setopt EXTENDED_GLOB
% var=(#i)$cmd
zsh: bad pattern: #i
--
vq
next prev parent reply other threads:[~2022-10-26 22:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-26 21:11 Ray Andrews
2022-10-26 21:38 ` Roman Perepelitsa
2022-10-26 21:49 ` Ray Andrews
2022-10-26 21:57 ` Lawrence Velázquez
2022-10-26 22:07 ` Ray Andrews
2022-10-26 22:19 ` Lawrence Velázquez [this message]
2022-10-27 0:00 ` Ray Andrews
2022-10-27 0:36 ` Lawrence Velázquez
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=eebfb68f-9e06-4b51-9113-a883fbee7bc6@app.fastmail.com \
--to=larryv@zsh.org \
--cc=rayandrews@eastlink.ca \
--cc=zsh-users@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).