I have an array, index is the hard drive size and value is number of hard drives having same size. So this is what i do.
DRIVE_SIZES[$DRIVE_SIZE]=`expr ${DRIVE_SIZES[$DRIVE_SIZE]} + 1`
I have not initialized the DRIVE_SIZES array to 0. So above line might not work. I would like to initialize a sparse array in bash script.
Lets say all drives in the host are of the same size, except one. Some 10 drives are of size 468851544 and one drive is of size 268851544. So I cannot initialize all index from 0-468851544 because I dont know the maximum disk size beforehand.
So is there a way to initialize such an sparse array to 0. May be if there is way to declare an integer array in bash that might help. But after some initial research found out I can declare an integer, but not integer array(might be wrong on this). Can someone help me with this ?