[Top][All Lists]

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

Re: declare -n next=arr[++elem] == nowork ? [[ -v

From: Alex fxmbsw7 Ratchev
Subject: Re: declare -n next=arr[++elem] == nowork ? [[ -v
Date: Tue, 9 Mar 2021 18:47:23 +0100

ill maybe make a post there, i just joined, other account was there but
seemfuly didint work out

about to ${#arr[@]} i forgot \\ didnt watch, i was backly thinking of
saving the var to an 'isend' var, but that was old style before that, i
wasnt using it cause i thought speedful backdraw, to always recheck the
also if faulty code adds a non idx++ key that fails, of course thats not my
case but it comes to mind

on my todo list: more help-bash and benchmarks

thank you

On Tue, Mar 9, 2021 at 6:13 PM Chet Ramey <chet.ramey@case.edu> wrote:

> 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    chet@case.edu    http://tiswww.cwru.edu/~chet/

reply via email to

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