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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -