linux - Store values from arrays in config-file to variables -


I have found the following problem: I found a config-file with many arrays (written in Bash), these arrays From config to config, there are three values ​​in each array

Now, this config file is taken in the main Bash script. I want to go to the array from the array and store the values ​​in a single variable. My actual solution: If desired for [= "$ i" = 0] then <= (i = 0; i = 2; i ++)) then desired = 1 = "$ {array0 [" $ i "for If desired ["$ i" = 2] then = "$ {array0 [" $ i "=" $ {"$ i" = 1] then the desired value = "$ {array0} ["$ I"]}]} "Previously

I think it will work for a specific array. But I would like to analyze each array in this kind of config file How can I tell the script for you?
Thanks for any help!

In the ranks, the ARM can be found through the set . It removes the names of those arrays in which there are three elements:

  set | Sed -n 's / ^ \ ([_A_Za-z] [_A-Za-z0-9] * \) = (\ [0] =. * \ [2] = "[^" * *]) $ / (number of your backslash It depends on your  sed  bid. It works for me on Debian, where there are metachactors for backslashed brackets group, and bare brackets are literally matched.) < / P> 

not really me So that you just want us to use a loop to remove the three elements, but it is the strength of the way here.

  $ (set | sed -n 's / ^ \ ([_ A_Za-z] [_A-Za-z0-9] * \) = (\ [0] =. * For \ [2] = "[^"] * ") $ / \ 1 / p '); ((i = 0, j = 1; i  

This will be one if you just use another array for the desired qualities, then it is easy.

/ Div>

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -