Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
nested parameter expansion
- X-seq: zsh-users 26079
- From: "jdh" <dhenman@xxxxxxxxx>
- To: <zsh-users@xxxxxxx>
- Subject: nested parameter expansion
- Date: Thu, 24 Sep 2020 01:03:11 -0700
- Archived-at: <https://zsh.org/users/26079>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-users/2020-09/20200924010311.7083%40binki>
- Authentication-results: zsh.org; iprev=pass (mail-pl1-f178.google.com) smtp.remote-ip=209.85.214.178; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none
- Cc:
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:subject:date:from:message-id; bh=YS4zmdB1r6j0OB+mZkVtG9zGbemtfwfCz/r+OzypjCU=; b=u1JVrRxENp0FxkucqQYTwCpJ/SqUOXVNUY24Mya36yJ0zuUW0PJmJb8Ye+EYUtcw5M UXwf7GkKWU1oDvNFSIcmmXNrbP1HQnfZ05WIo5YXvAncTsKGP+kQZ2FQggX2zxK7oLUc 0SUyuiu3VAHNOKsGvJ+PlgkpoM7w03vYo6BD4PfFPQlalSg5mihHtFgaQTb07fYeQEQv vTxrvpJ4rnZsNLkGguo/vOZJ1g/Yw6w+cWvtcSGIz9xmEXFhbpLK1zAL7jqgFw8fstx9 Yus1Sa+B00jc9fEZQfbNgDbPBK07r0+ik2x6bTm+PujB2Tpg4ZXEukBI4owgbC8kek9Z o5mQ==
- List-archive: <http://www.zsh.org/sympa/arc/zsh-users>
- List-help: <mailto:sympa@zsh.org?subject=help>
- List-id: <zsh-users.zsh.org>
- List-owner: <mailto:zsh-users-request@zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-subscribe: <mailto:sympa@zsh.org?subject=subscribe%20zsh-users>
- List-unsubscribe: <mailto:sympa@zsh.org?subject=unsubscribe%20zsh-users>
- Sender: zsh-users-request@xxxxxxx
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
print ${~P${ndx}_ARRAY}
#results in: "zsh bad substitution
print ${(P)P${ndx}_ARRAY}
#results in: "zsh bad substitution
I want to do a simple 'for' loop like this:
for ndx in ("1" "2" "3") # for multiple arrays not defined in this simple example.
do
for element in ${P${ndx}_ARRAY}
do
print "Process element."
done
done
Any assistance would be appreciated
Messages sorted by:
Reverse Date,
Date,
Thread,
Author