@@ -93,6 +93,48 @@ the configuration option is changed from its default value using the
9393environment variable is defined accordingly. See
9494:envvar: `MODULES_PATH_ENTRY_REORDER ` for details.
9595
96+ .. _Linked environment variables :
97+
98+ Linked environment variables
99+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
100+
101+ A new configuration option, :mconfig: `linked_envvars `, can be used to
102+ automatically mirror environment variable changes onto other environment
103+ variables.
104+
105+ When a modulefile modifies an environment variable using commands such as
106+ :mfcmd: `setenv `, :mfcmd: `unsetenv `, :mfcmd: `prepend-path `,
107+ :mfcmd: `append-path `, :mfcmd: `remove-path ` or :mfcmd: `pushenv `, the same
108+ operation is also applied to all variables linked through the
109+ :mconfig: `linked_envvars ` configuration option.
110+
111+ For example, with the following configuration:
112+
113+ .. parsed-literal ::
114+
115+ :ps: `$ ` module config linked_envvars "CPATH&INCLUDE_PATH"
116+
117+ loading a module that prepends a directory to ``CPATH ``:
118+
119+ .. parsed-literal ::
120+
121+ :sgrcm: `prepend-path ` CPATH /opt/pkg/include
122+
123+ will also prepend the same directory to ``INCLUDE_PATH ``.
124+
125+ Links are directional. In the previous example, changes made to ``CPATH `` are
126+ also applied to ``INCLUDE_PATH ``, but changes made directly to
127+ ``INCLUDE_PATH `` are not applied back to ``CPATH `` unless an explicit reverse
128+ link is configured.
129+
130+ When enabling this feature, note that existing values are not synchronized
131+ when the link is established. Only subsequent modifications performed through
132+ modulefile environment variable commands are propagated to linked variables.
133+
134+ The output of ``module display `` also includes the environment variable
135+ changes applied to linked environment variables, making these propagated
136+ updates visible before a module is loaded.
137+
96138
97139v5.6
98140----
0 commit comments