I am new to shell scripting, and I have a need which I am explaining by using a sample example. I have a property file which will contain data as shown below :
object1 : propertyA
object2 : property1 property2
object3 : propertyxyz
Note : On the whole I have some objects which can have any number of properties. And I need to keep this in a property files so that it can be changed as per need.
All I need is if I get object 3 as a user input then my code should print all the respective properties.
I have tried using .ini files, but I dont want to use any external parsers. And which ever comes with bash seems to not helping me in this case. if I use grep then I would have to split the properties using some regex.
.ini file which I created :
[object1]
property=propertyA
[object2]
property=property1
property=property2
[object3]
property=propertyxya
I am looking for a solution in which if I select an object ( which in case of ini files it is a section) then I should get all the properties in an array.
So is there any thing which is predefined in bash or do I need to write using grep n regex only.