bug-bash
[Top][All Lists]
Advanced

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

Re: New array_expand_once option


From: alex xmb ratchev
Subject: Re: New array_expand_once option
Date: Sat, 17 Jun 2023 13:58:59 +0200

On Thu, Jun 15, 2023, 20:40 alex xmb ratchev <fxmbsw7@gmail.com> wrote:

>
>
> On Thu, Jun 15, 2023, 15:06 Chet Ramey <chet.ramey@case.edu> wrote:
>
>> On 6/14/23 5:18 PM, alex xmb ratchev wrote:
>>
>> >     [[ -v a["$subscript"] ]]
>>
>
a small question about that .. do the quotes matter ?

>
>> >     is already an arithmetic expansion error in bash-5.2, but not in
>> bash-5.1.
>> >
>> >
>> > hello there ..
>> >
>> > i dont get much
>> > it d be an arith err if array wasnt -A
>> > .. ?
>>
>> Yes, because only one expansion is performed, and so the subscript is the
>> command substitution, which is not a valid arithmetic expression.
>>
>
> very good
> i like now it works like this , . the old was bugged
>
> >
>> > so i shopt -s array_expand_once
>> > and [[ -v foo["$var"] ]]
>> > .. is the right way ? ( for the change , the future )
>>
>> It's not as important for compound commands like [[, but for builtins like
>> test/[, yes, this is the way to use it.
>>
>
> alright , thanks
>
> greets
>
> --
>> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>>                  ``Ars longa, vita brevis'' - Hippocrates
>> Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/
>>
>>


reply via email to

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