A solution for nested array in bash