Where can I find documentation on the /etc/environment file format?
From System-wide environment variables:
- /etc/environment - This file is specifically meant for system-wide environment variable settings. It is not a script file, but rather consists of assignment expressions, one per line. Specifically, this file stores the system-wide locale and path settings.
I'm looking for an ABNF and/or a more detailed description of behaviour, or anything that isn't forum hearsay really.
If it's on Google, it's eluding me.
I'm not sure why this isn't made more clear, but /etc/environment
isn't parsed by any single bit of code or any particular shell (or necessarily any shell at all) (try grep -r "/etc/environment" /etc
and you'll see what I mean). pam
in particular parses it directly, not putting it through a shell.
By convention, and I do mean convention, it's pure key-value pairs, with values optionally quoted. You can't put anything that tries to do e.g. variable expansion or command execution in there and expect it to work.
I'd be surprised if you can find a strict, formal grammar definition anywhere.
Probably the closest to an authoritative answer you can come is the pam_env
docs: http://www.linux-pam.org/Linux-PAM-html/sag-pam_env.html
You can find good information in the environ man page.
It is accessible from a terminal, by typing man 7 environ
in it.
By convention the strings in environ have the form "name=value".
You can also read it from your browser: http://manpages.ubuntu.com/manpages/lucid/en/man7/environ.7.html#toptoc2
And it gives you some examples of usage and more details.