For people (like me) looking to read INI files from shell scripts (read shell, not bash) - I've knocked up the a little helper library which tries to do exactly that:
https://github.com/wallyhall/shini (MIT license, do with it as you please. I've linked above including it inline as the code is quite lengthy.)
It's somewhat more "complicated" than the simple sed
lines suggested above - but works on a very similar basis.
Function reads in a file line-by-line - looking for section markers ([section]
) and key/value declarations (key=value
).
Ultimately you get a callback to your own function - section, key and value.