> On 2/17/12 8:25 AM, Pierre Gaston wrote: > > This is probably because bash lacks an easy way to pass an array by > > reference to a function. > > This is where a requested feature could make it into bash. This seems to > be a common problem with no clean solution (one can only get so far with > eval and ${!param}). > > The ksh93 `nameref' (typeset -n) feature would solve this. It's not really > well documented, and there are many corner cases to catch, but it's not > that hard to implement. One example: is it a symlink, where it's resolved > at reference time, or a pointer, where the reference is assigned at initial > declaration? Another set of cases involve the scoping questions if the > first alternative is chosen.
The next version of bash will have nameref variables and associated support (declare/local -n, unset -n, slight changes to ${!var}, and so on). The devel git tree has all of the changes. If you're interested, check it out and send me feedback. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/