zsh-users
 help / color / mirror / code / Atom feed
* Expand each array element with ${(P)...}
@ 2024-02-06  6:50 Marlon Richert
  2024-02-06  7:25 ` Roman Perepelitsa
  0 siblings, 1 reply; 3+ messages in thread
From: Marlon Richert @ 2024-02-06  6:50 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 517 bytes --]

I have an array of variable names that I would like to expand to an array
of these variables' values.

I was expecting that if $names is an array, then ${(P)names} – or perhaps
something like ${(PA)names[@]} – would perform ${(P)...} expansion on each
element, but it doesn't. It just expands the first element in the array
instead and leaves out the rest.

Is there any way to make this work without using a for loop? I could not
find any combination of (nested) expansion flags that does what I want.

[-- Attachment #2: Type: text/html, Size: 1264 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-06  7:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-06  6:50 Expand each array element with ${(P)...} Marlon Richert
2024-02-06  7:25 ` Roman Perepelitsa
2024-02-06  7:40   ` Lawrence Velázquez

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).