On Fri, Aug 2, 2013 at 8:12 PM, Terrence J. Doyle <[email protected]> wrote: > > That explains the format change. While this seems a bit inconsistent > with the output of ${!array[@]}, I'm not going to quibble about format. > > However, my comments concerned the reporting of nonexistent > indexes/keys. What's the purpose of the construct if it reports an array > index/key where none exists? To put it another way, before the change > the test: > > [[ ${!array[$index]} ]] > > was useful. Now, it's meaningless since it's always true -- even if > $index isn't an index of the array.
Erm... do you want to figire out whether an element in array is set or not ? ksh93 has the [[ -v ... ]] operator for that, e.g. typeset -a ar=( 2 3 4 ) ; [[ -v ar[1] ]] && print 'ok1' ; [[ -v ar[9] ]] && print 'ok9' will print 'ok1' Note that this uses the variable names and not the value to test... which is vastly faster than trying to test the value. ---- Bye, Roland -- __ . . __ (o.\ \/ /.o) [email protected] \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 3992797 (;O/ \/ \O;) _______________________________________________ ast-users mailing list [email protected] http://lists.research.att.com/mailman/listinfo/ast-users
