303 for count in "${nodeof[@]}"; do
304 lines=`GetNodeMemory $count`
305 printf %s "$lines" | while IFS= read -r line; do \
306 {
307 key=`echo $line | awk -F':' '{print $1}' | cut -d' ' -f3`
308 [[ -z ${key} && ${key} ]] && continue
309 for chk in "${MemVar[@]}"; do
310 [[ "${key}" == "${chk#*:}" ]] && break
311 done
312 #echo "ke:${chk#*:} - ind:${chk%%:*}"
313 NodeMem[$count,${chk%%:*}]=`echo $line \
314 | /bin/grep -i "${key}" | awk -F':' '{print $2}' \
315 | cut -d' ' -f2`
316 #echo "${chk#*:} ${NodeMem[$count,${chk%%:*}]}"
317 chk=""
318 } done
319 done
320
321 for count in "${nodeof[@]}"; do
322 for chk in "${MemVar[@]}"; do
323 echo "${NodeMem[${count},${chk%%:*}]}"
324 done
325 done
Here NodeMem is a two dimensional array, and if I print using line#316, array values print fine. But, if print using line#323, output is just empty lines. What is happening here? Thanks for the help.