Re: {ref}<&- does not work on array reference subscripts

2016-06-02 Thread Grisha Levit
I was thinking maybe some {get,set,unbind}_var_or_array_elem functions
would help since there are a number of places that all need to handle this
consistently.  Could catch the case of using subscripts on
array-reference-namerefs in such a function as well.


Re: {ref}<&- does not work on array reference subscripts

2016-06-02 Thread Chet Ramey
On 6/1/16 6:44 PM, Grisha Levit wrote:
> Yikes, I missed the |exec| command in my example, that would certainly make
> it confusing..
> 
> What I meant was that the assignment works (i.e. the nameref is followed
> correctly), but the relevant code
> 
> doesn’t handle retrieving the value of such a nameref when it needs to do
> so to close the descriptor:

Yes, you're right.  The fix is very similar to part of the fix for the
unset builtin.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



Re: {ref}<&- does not work on array reference subscripts

2016-06-01 Thread Grisha Levit
Yikes, I missed the exec command in my example, that would certainly make
it confusing..

What I meant was that the assignment works (i.e. the nameref is followed
correctly), but the relevant code

doesn’t handle retrieving the value of such a nameref when it needs to do
so to close the descriptor:

$ declare -n ref=var[0]
$ exec {ref}

Re: {ref}<&- does not work on array reference subscripts

2016-06-01 Thread Dan Douglas
You also noticed it runs in a subshell generally. Do you expect
something different here? I think <&- should be consistent.

On Wed, Jun 1, 2016 at 5:15 PM, Grisha Levit  wrote:
> declare -n ref=var[0]
> {ref} {ref}<&-  # fails



{ref}<&- does not work on array reference subscripts

2016-06-01 Thread Grisha Levit
declare -n ref=var[0]
{ref}