Re: test '-v' - associative vs. normal array discrepancy - a bug ?
From:
Chet Ramey
Subject:
Re: test '-v' - associative vs. normal array discrepancy - a bug ?
Date:
Sun, 23 Nov 2014 13:55:07 -0500
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.2.0
On 11/21/14 4:43 PM, Greg Wooledge wrote:
> OK, right off the bat, you are using an undocumented HACK:
>
> function filter {
> local REF="$1[@]" X
>
> I don't remember whether we ever got official word from Chet on whether
> this syntax would continue to be supported in the future. It seems to
> me more of an accidental misfeature that people have latched onto because
> there is no other way to get things done. (Besides eval.)
>
> The fact that one must use this undocumented hack (which may or may not
> magically vanish the next time Chet tightens up the grammar) in order
> to retrieve values from an array whose name is passed as an argument is
> already one strike against it.
Wow, that's a pretty tendentious argument. That syntax has been accepted
since I implemented arrays, ksh93 and other shells that implement arrays
accept it, I explicitly made it supported for compatibility, and I
recommended its use earlier this week. I don't think it will be going
away.
(And it has nothing to do with the shell grammar.)
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/