bug-bash
[Top][All Lists]
Advanced

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

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


From: Pierre Gaston
Subject: Re: Indirect access to variables, including arrays (was Re: Compare 2 arrays.)
Date: Thu, 7 Jun 2012 10:01:51 +0300

On Thu, Jun 7, 2012 at 6:07 AM, Linda Walsh <bash@tlinx.org> 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 just not as simple and pretty as nameref.

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;
}



reply via email to

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