On 6/14/23 5:18 PM, alex xmb ratchev wrote:
[[ -v a["$subscript"] ]]
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.
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.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/