[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: feature suggestion: ability to expand a set of elements of an array
From: |
Greg Wooledge |
Subject: |
Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices |
Date: |
Fri, 28 Jun 2024 09:10:44 -0400 |
On Fri, Jun 28, 2024 at 08:50:50 -0400, Zachary Santer wrote:
> Is "${array[@]( "${indeces[@]}" )}" ugly? Does that matter? It seems
> like a good way to write what's happening. I still have to look up
> some of the less-commonly-used parameter expansions every time I use
> them. I think people would kind of "get" this more readily.
I'm still wondering when you'd ever use this in a shell script.
The first thing I can think of is "I'm presenting a menu to the user,
from which zero or more items may be selected. The user's selection
indices are read into an array. I want to map those selections to another
array to get the filenames-or-whatever-they-are."
In such a script, I would write a loop, retrieve the filenames one at a
time, and process them or append them to a list, depending on what the
script is supposed to do with them.
The amount of work it would take to support this new syntax seems like it
would exceed the value it adds to the quite rare script that would use it.
- Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices, (continued)
- Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices, Zachary Santer, 2024/06/26
- Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices, Martin D Kealey, 2024/06/26
- Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices, Oğuz, 2024/06/27
- Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices, Zachary Santer, 2024/06/27
- Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices, Martin D Kealey, 2024/06/28
- Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices, Oğuz, 2024/06/28
- Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices, Martin D Kealey, 2024/06/29
- Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices, Zachary Santer, 2024/06/27
- Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices, Zachary Santer, 2024/06/27
Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices, Zachary Santer, 2024/06/28
- Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices,
Greg Wooledge <=
- Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices, Zachary Santer, 2024/06/28
- anonymous pipes in recursive function calls, Zachary Santer, 2024/06/28
- Re: anonymous pipes in recursive function calls, konsolebox, 2024/06/29
- Re: anonymous pipes in recursive function calls, Zachary Santer, 2024/06/29
- Re: anonymous pipes in recursive function calls, konsolebox, 2024/06/29
- Re: anonymous pipes in recursive function calls, Zachary Santer, 2024/06/29