Why is the integer variable disappearing in this bash while loop? -
i'm trying list array of directory names using while loop in bash script.
the loop code following (where $len length of $folderarray):
i=0 while [ $i -lt $len ]; echo "$i: ${folderarray[$i]}" let i++ done
however, output displayed follows:
0: folder1 folder2 folder3 etc.
why "1:" , "2:" not displayed folder2 , folder3?
i read using process substitution solve i'm not sure how here.
it shows stored items in 1 element of array:
"${folderarray[0]}"
if tried word splitting before that, weren't able split them @ all. consider checking code use store lines folderarray
.
Comments
Post a Comment