Generate variables dynamically to fill a list

0

Good I have the following doubt, I have this code in which I fill the variables of a list depending on the values of a string variable to which I separate the items according to the; I bring that string, sialgun value of the string changes it shows me ok.

Now how can I dynamically generate the number of variables contained in the list, because in the example I have 4 variables because the string data has 4 data, but in the case that the string contains "1; 2; 3 ; 4; 5; 6; 7; 8 "I would need that inside the list there are 8 variables, not 4. Probe in the following way and obviously it is wrong because the array is filled with , because the variables generated in $ {"Number". $ i} have no value:

Then probe in this way (it was wrong to see it) and then, when you pass the array to string and separate it by commas, save the data in $ separated_by_comas, the question is that if I make an echo of $ separa_por_comas it shows me the data ok but if I put that variable in the list it does not work.

on the other hand if I copy the echo and put it in the variable if it works.

Finally leaving all these print and explanations (which may not make sense and build anything) as I can do to dynamically create variables to complete a list depending on the data that contains another variable (string from which I get the data separating it by;)

    
asked by Juan 22.10.2017 в 19:54
source

0 answers