Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to access a configuration file from a Makefile, and thus seek for a short-readable-maintanable way of doing. The file is a python ConfigParser compliant file.

bar = baz

I use this python oneliner which I found cumbersome

python -c "import ConfigParser; config = ConfigParser.ConfigParser();'foo.cfg');print config.get('foo','bar')"

Since it is the same format used in git config files, I noticed that git config -f foo.cfg --get might do the job, but (1) my section name got an underscore, which is not supported by git-config, and (2) it adds an heavy build dependancy for weird and accessory purpose .

I have seen this format used so many time that I think it might exists a better way.

My questions are:

  • does this config format get a name ? (which might help for web search)
  • is there any standard CLI tools (as simple as git-config) to read these files?
share|improve this question
That looks like an "INI file" format. You may want to write a wrapper-function (or script) so that you can simplify your Makefile commands. See – RedGrittyBrick Oct 23 '12 at 10:19

You must log in to answer this question.

Browse other questions tagged .