[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 08:58:59 +0300 |
On Thu, Jun 7, 2012 at 6:07 AM, Linda Walsh <bash@tlinx.org> 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 understand.
>
> Are you saying that ${!nameofvar} isnt' supported?
in ksh93 you can do:
$ function foo { nameref locarr=$1;echo ${locarr[0]};locarr[0]=newfoo; }
$ array=(foo bar baz)
$ foo array
foo
$ echo ${array[0]}
newfoo
There is nothing that easy in bash.