[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /etc/environment: syntax



Andrew Schulman <andrex@alumni.utexas.net> writes:

>> the syntax in /etc/environment is documented as:
>>    VAR=value
>> 
>> My questions:
>> Can you specify several paths as value? (Are these paths delimited by 
>> colons?)

The statements in /etc/environment are simply used as environment
variables. How a specific environment variable is interpreted depends on
the program that interprets it.

>> Can i specify an existing environment variable in value? (How is the 
>> syntax there? $VAR or ${VAR} ?)

No.

> /etc/environment is sourced by the pam_env module of PAM.  See 
> http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html/pam-
> 6.html#ss6.5.  Unfortunately it doesn't say much about /etc/environment 
> except that in consists of VAR=VALUE pairs.  I guess you'll just have to 
> experiment to see what happens if you try to use something more 
> complicated.

A look at the pam_env source code reveals that the statements in
/etc/environment are only minimally modified: Comments are removed,
quotes around the value are ignored, and a leading "export " is ignored
(so that /etc/environment can also be used as a shell script fragment).
Variable interpolation is not supported.

Martin



Reply to: