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.

Reply via email to