Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

Many projects these days use more than one programming / scripting language, and in standard DRY tradition these should not have separate configuration files if they need the same information. After a small survey in /etc, it looks like a lot of incompatible syntaxes are used in Ubuntu:

  • varname=value - /etc/adduser.conf
  • varname: value - /etc/debconf.conf
  • varname = value - /etc/deluser.conf
  • $varname value /etc/insserv.conf
  • varname value - /etc/login.defs
  • set varname value - /etc/lftp.conf
  • [section]
        varname = value


  • section
        label varname value
        set varname value


As far as I can see, none of these are "Yaml or XML or JSON," (one of them is INI though). Which format would you recommend (and why) for a project which needs to provide simple values (debug = true, welcome = "Hello world!", threads = 4), arrays of simple values (servers = [dev, test, prod]), and values which refer to other variables (thread_msg = "Using $threads threads") to Bash, Perl and PHP?

share|improve this question
AFAIK, the first 3 are basically the same. – Tshepang Jul 12 '11 at 14:04
@l0b0 the first 3 are serialization formats which aren't configuration formats. I suggest using an actual configuration format like INI or Apache Style (Config::General in Perl). – xenoterracide Jul 12 '11 at 15:27
@l0b0 also that author lead his question on SO... and simply left out some of the options... while thinking like a programmer. While your OS designer's are thinking like admins and thus not making things a PITA for users. – xenoterracide Jul 12 '11 at 15:31
up vote 3 down vote accepted

The first 3 are serialization formats which aren't configuration formats. These formats are easy for machines to read and write but not as easy for humans to read and write. Do not use them for configuration. Your users will likely hate you for it.

Also some of these files are simply NAME value pairs. Others might not really be configuration files but shell files, meaning they can basically be sourced by a shell for processing.

I suggest using an actual configuration format like INI or Apache Style (Config::General in Perl)

Config::Any is a good choice of perl module for loading a config, because it allows the user to essentially pick the format of their choice.

share|improve this answer
I'm going for AppConfig since it's already installed on the system, but yours was the best suggestion. – l0b0 Jul 13 '11 at 13:45
@l0b0 I'd look at Config::Any because then all the formats are basically supported. – xenoterracide Jul 15 '11 at 22:19

I would use a format, which can be sourced by bash as is, because in bash it isn't easy to read, parse and execute other formats, while Perl is more or less a language, written for such tasks, and in PHP it should be easy too.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.