On Wed, Jun 26, 2024 at 10:58 AM Chet Ramey <chet.ra...@case.edu> wrote: > > On 6/11/24 6:48 AM, Zachary Santer wrote: > > > My mind returns to this nonsense, as I find a use for it. > > > > Imagine this functionality: > > $ array=( zero one two three four five six ) > > $ printf '%s\n' "${array[@]( 1 5 )}" > > one > > five > > I'm not inclined to implement this. I don't like the syntax and there are > already other ways to get the values you want.
Within a single array expansion, the other way I can think of would be building the array you need out of elements of the other array you started with, then expanding that. I did have the thought that without ${parameter:offset:length}, there'd really be no way to get the same effect, for a scalar variable, outside of doing something really obnoxious with a here string and read commands in a { } group. Whereas, what I proposed here is much more of a nice-to-have. If you wanted to achieve this functionality, I'm not sure what a better syntax would be. I did want to see if others would find this valuable, and no one spoke up, so it's whatever.