zsh-users
 help / color / mirror / code / Atom feed
From: "jdh" <dhenman@gmail.com>
To: <zsh-users@zsh.org>
Subject: Re: nested parameter expansion
Date: Thu, 24 Sep 2020 10:07:26 -0700	[thread overview]
Message-ID: <20200924100726.5496@binki> (raw)
In-Reply-To: Your message of Thu, 24 Sep 2020 09:15:25 +0100 (BST) <1356305032.19895.1600935325161@mail2.virginmedia.com>


Thanks for the information Roman & Peter.
Much appreciated.

---------

Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> 
> > On 24 September 2020 at 09:03 jdh <dhenman@gmail.com> wrote:
> > I can't get, what should be simple nested parameter to work.
> > I think that $ndx needs to be expanded before the letter P before it 1st.
> > 
> > Simple example:
> > 
> >     ndx=1
> >     P1_ARRAY=("1" "2" "3")
> >     
> >     print ${P${ndx}_ARRAY}
> > #results in: "zsh bad substitution
> 
> I don't think there's a simple way to do it without an extra intermediate
> variable:
> 
> var="P${ndx}_ARRAY"
> print ${(P)var}
> 
> You could add some eval trickery, but I suspect it's not worth making it any
> more complicated.
> 
> pws
> 



      parent reply	other threads:[~2020-09-24 17:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24  8:03 jdh
2020-09-24  8:15 ` Peter Stephenson
2020-09-24  8:29   ` Roman Perepelitsa
2020-09-24 17:07   ` jdh [this message]

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=20200924100726.5496@binki \
    --to=dhenman@gmail.com \
    --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).