Re: Indirect access to variables, including arrays (was Re: Compare 2 arrays.)

2012-06-07 Thread Bill Gradwohl
On Thu, Jun 7, 2012 at 1:01 AM, Pierre Gaston wrote: > Fwiw here is a robust and simple solution for in_: > > _in () { > local e t > t="${2:?}[@]"; > for e in "${!t}"; do [[ $1 = "$e" ]] && return 0;done > return 1; > } > > The following won't have a name space collision with the 'e' variable

Re: Indirect access to variables, including arrays (was Re: Compare 2 arrays.)

2012-06-07 Thread Pierre Gaston
On Thu, Jun 7, 2012 at 12:27 PM, Dan Douglas wrote: > On Thursday, June 07, 2012 10:01:51 AM Pierre Gaston wrote: >> On Thu, Jun 7, 2012 at 6:07 AM, Linda Walsh wrote: >> >(no I haven't made it space/bracket...whatever proof...just a bit >> > more work) >> >> It's not just "a bit more work", ther

Re: Indirect access to variables, including arrays (was Re: Compare 2 arrays.)

2012-06-07 Thread Dan Douglas
On Thursday, June 07, 2012 10:01:51 AM Pierre Gaston wrote: > On Thu, Jun 7, 2012 at 6:07 AM, Linda Walsh wrote: > >(no I haven't made it space/bracket...whatever proof...just a bit > > more work) > > It's not just "a bit more work", there are many workarounds but it's not > really possible to ma

Re: Indirect access to variables, including arrays (was Re: Compare 2 arrays.)

2012-06-07 Thread Pierre Gaston
On Thu, Jun 7, 2012 at 6:07 AM, Linda Walsh wrote: >(no I haven't made it space/bracket...whatever proof...just a bit > more work) It's not just "a bit more work", there are many workarounds but it's not really possible to make a really robust generic solution for assignment, and in the end it ju

Re: Indirect access to variables, including arrays (was Re: Compare 2 arrays.)

2012-06-06 Thread Pierre Gaston
On Thu, Jun 7, 2012 at 6:07 AM, Linda Walsh wrote: > > > Greg Wooledge wrote: >> >> The only Bourne-family shell that can manipulate arrays whose names are >> passed to a function is ksh93, with its "nameref" command.  Bash has >> nothing analogous to that yet. > > = > > I don't unders

Indirect access to variables, including arrays (was Re: Compare 2 arrays.)

2012-06-06 Thread Linda Walsh
Greg Wooledge wrote: The only Bourne-family shell that can manipulate arrays whose names are passed to a function is ksh93, with its "nameref" command. Bash has nothing analogous to that yet. = I don't understand. Are you saying that ${!nameofvar} isnt' supported? I need a fun