On 3/8/21 11:19 AM, Alex fxmbsw7 Ratchev wrote:
thank you for your answer
i have a question about [[ -v $next ]] i havent tried but you say it works it would ? expand $next but wont it then check '[[ -v <content_of_next> ]]' and fail ?

Try it. -v will evaluate an array reference with a subscript to see if that
particular element exists, but the general nameref resolution code does not
(and should not) re-evaluate an array expansion.

ill benchmark the usage of : $next ; before [[ -v now, if its minimal its all fine i can use
i just remember it used to work

I doubt it, but it doesn't matter now.

for the [[ -v arr[++elem] ]] style i do cause i can add in the loop to the array and it continues over the new elements, till no more

Come on, so does iterating from 0 to ${#arr[@]}.

i also have another this-same-declare issue with a more complex data structure

I think help-bash would be a good place for that discussion.

--
``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/

Reply via email to