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:31:29 -0400

On Thu, Jun 27, 2024 at 1:08 AM Oğuz <oguzismailuysal@gmail.com> wrote:
>
> Why not extend the arithmetic expansion syntax to allow generating multiple 
> results when subscripting indexed arrays? Like `${a[1; 2; 4]}', `${a[3..5; 
> 7]}', `${a[1..10..3]}', etc.

Doing this, you lose the ability to provide the list of indices you're
interested in in the form of an array. This list couldn't be arbitrary
and generated at run-time.

> These would expand like `$@' when in double quotes and like `$*' when being 
> assigned to a variable.

"${*}" expansion is also necessary in other situations than when
assigning to variables. It must be possible to still specify "${@}"
and "${*}" expansion explicitly.



reply via email to

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