On Wed, Oct 18, 2023 at 8:47 AM alex xmb sw ratchev <fxmb...@gmail.com>
wrote:

> by chet stating many times that every bash item undergoes expansion ..
>
As in, Bash expands
$ printf '%s\n' "${array["{2..6..2}"]}"
to
$ printf '%s\n' "${array[2]}" "${array[4]}" "${array[6]}"
on its way to giving you
two
four
six
That took me a while to comprehend. Alright, I take back that it isn't
documented anywhere.

u miss at least once the quotes of ['{blabla}']
>
Yeah, I was trying different, seemingly-related things.

its both the 1+ args
> $@ expands to different args
> "$@" to preserve spacesafe
>
> $* expands the same ( all args ) to one-arg
> "$*" spaceaafe
>
I know that. I don't really get what you're getting at, here.

This doesn't work either, obviously:
$ printf '%s\n' "${array["${indices[*]}"]}"
-bash: 2 4 6: syntax error in expression (error token is "4 6")
$ printf '%s\n' "${array["${indices[@]}"]}"
-bash: 2 4 6: syntax error in expression (error token is "4 6")

I guess I still want to hear about "${#@}" and $[  ]. Sorry about bringing
them up in relation to something that *is* documented.

Zack

Reply via email to