1
I am developing a shell system that has a form to add some fields.
Quantity Product Valorunitario etc...
I need every time the loop changes a variable, so I call it in the form!
In the case is the Prev, at each round he switches to prev1, at the other prev2 switches to prevdois1, ai at the other round, prev2, prevdois2 and so on, this because I will call these variables to save in a form. some help?
while [ "$sair" != "sair" ]; do
i=$((i+1))
for filter in Produto Quantidade Descricao PrecoUnitario PrecoTotal; do
read -p "${filter}: " ${filter}$i
**prev=$Produto
prevdois=$Quantidade**
done
read -p "Deseja sair? [sair] ou enter para continuar: " sair
done
You want to add in front 1, 2, 3 .... of the Prev string?
– Wictor Chaves
THAT! could be! is that I need to call these different variables in each round for a form! In case we will say that in the first step the Prev is worth avocado Prev=avocado in the second Prev it is worth pineapple 2prev=pineapple And so on!
– Jefferson Rocha
I’ve never seen this asterisk-placing syntax
*
before the variable name– Jefferson Quesado
This because I put bold here on the site kkkkk, discard! I could not express myself right! I need each loop to change and stay fixed! So I can call in the form... since they are different products. Got it? the output will be in an HTML file, problem that the output as expected is always the last round. and I needed it to be independent... Example: <tr> <td>$Prev</td> <td>$prevdois</td> </tr> <tr> <td>$Prev</td>#Xa; <$prevdois</td> </tr>
– Jefferson Rocha