| 1 |
.. _init-envvars: |
| 2 |
|
| 3 |
Initialize environment variables |
| 4 |
================================ |
| 5 |
|
| 6 |
This document describes the mechanism to initialize an environment variable to |
| 7 |
a given value the first time this variable is changed. |
| 8 |
|
| 9 |
This is especially useful for variable like ``MANPATH`` that requires a |
| 10 |
leading or finishing colon character in addition to the specific paths defined |
| 11 |
to still be able to query the system man pages. |
| 12 |
|
| 13 |
Design choices: |
| 14 |
|
| 15 |
* If environment variable is changed and currently not defined, set it to the |
| 16 |
defined initial value prior applying the change |
| 17 |
* When removing value to path-like environment variable, if after the removal |
| 18 |
it equals the initial value without specific reference counter, unset the |
| 19 |
environment variable |
| 20 |
|
| 21 |
This mechanism applies to all path-like environment variable management |
| 22 |
modulefile commands and module sub-commands: |
| 23 |
|
| 24 |
* :mfcmd:`append-path` |
| 25 |
* :mfcmd:`prepend-path` |
| 26 |
* :mfcmd:`remove-path` |
| 27 |
|
| 28 |
``init_envvars`` configuration option |
| 29 |
------------------------------------- |
| 30 |
|
| 31 |
New configuration option :mconfig:`init_envvars` is made to define the initial |
| 32 |
value of the environment variables. |
| 33 |
|
| 34 |
* Items are separated by colon character |
| 35 |
* Each item has the following syntax: ``VARNAME=initial_value`` |
| 36 |
|
| 37 |
.. vim:set tabstop=2 shiftwidth=2 expandtab autoindent: |