bash - Values in a variable need to be assigned 1:1 like in an array, but not working -


let assume, have varying number of values stored in variable (called my_variable). first ones i.e.: 12345 67890 ...

i go through list of values , assign them 1:1 array-based variable following:

my_array[0]=12345    my_array[1]=67890 ... 

how can achieved?

please note: when trying loop fails my_array[0] shows all values (12345, 67890, ...) inside.

my bash version: gnu bash, version 3.2.39(1)-release (i486-pc-linux-gnu)

my_array=( $my_variable ) 

will separate values separated spaces my_array beginning index @ 0.

you view array values with:

${my_array[0]} ${my_array[1]) etc... 

viewing values in array @ once with:

${my_array[@]} 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -