i=0
while true; do
    a[$i]=foo
    i=$((i+1))
    printf "\r%d " $i
done
This simple script shows on my systems (Gnu/Linux and Solaris):
- ksh88limits the size to- 2^12-1(4095). (- subscript out of range). Some older releases like the one on HP-UX limit the size to- 1023.
- ksh93limits the size of a array to- 2^22-1(4194303), your mileage may vary.
- bashdoesn't look to impose any hard-coded limit outside the one dictated by the underlying memory resources available. For example bash uses- 1.3 GBof virtual memory for an array size of- 18074340.
 Note: I gave up with mksh which was too slow executing the loop (more than one hundred times slower than zsh, ksh93 and bash.)
Edited to indent.
 
                