On 2/16/15 3:38 PM, SN wrote: > By the way, empty arrays seem to be reported as "not set". > a=(); test -v a || echo "not set" > This might be related (or not), but consider that the return > status of `test -v' > is different on a bash version unaffected by the bug that I have > tried (4.2.37).
References to an array without a subscript always reference element 0. There's not really a clean way to check whether an array has been declared but explicitly assigned an empty list, and it's not clear whether or not an array without at least one assigned subscript should count as `set' at all. If you want to see whether or not an array has been assigned at least one element, you can check whether ${#a[@]} > 0. 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/