bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash tries to parse comsub in quoted PE pattern


From: Zachary Santer
Subject: Re: bash tries to parse comsub in quoted PE pattern
Date: Wed, 18 Oct 2023 09:39:36 -0400

On Wed, Oct 18, 2023 at 8:47 AM alex xmb sw ratchev <fxmbsw7@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

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