bug-bash
[Top][All Lists]
Advanced

[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: Zachary Santer
Subject: Re: feature suggestion: ability to expand a set of elements of an array or characters of a scalar, given their indices
Date: Thu, 27 Jun 2024 09:49:05 -0400

On Thu, Jun 27, 2024 at 9:12 AM Zachary Santer <zsanter@gmail.com> wrote:
>
> This, though I would add the caveat that 'set -u'/'set -o nounset'
> should cause this expansion to fail and the script to error out if you
> supply an index without a matching value.

> And I guess my "${array[@]( index )}" would give the same behavior as
> your "${array[@][index]}".

Though "${array[@]}" doesn't result in an error with 'set -u' when
array is empty. Which is good. I'm not complaining about that. Given
that, you might want the same behavior from "${array[@]( index )}",
which would of course still apply when you are providing multiple
indices. Not sure of the best way this would work.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]