Skip to content

Commit ad4923a

Browse files
committed
doc: desc. bash-eval source-sh/sh-to-mod shell mode
1 parent 9382e20 commit ad4923a

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

NEWS.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ Modules 5.4.0 (not yet released)
144144
* Path element equals to delimiter character is allowed on
145145
:mfcmd:`append-path` and :mfcmd:`prepend-path` modulefile commands. (fix
146146
issue #522)
147+
* Add ``bash-eval`` shell mode to :mfcmd:`source-sh` modulefile command and
148+
:subcmd:`sh-to-mod` sub-command. With this mode, the generated output of the
149+
bash shell script is evaluated to get the environment changes instead of
150+
sourcing this script. (fix issue #519)
147151

148152

149153
.. _5.3 release notes:

doc/source/changes.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -892,8 +892,10 @@ The following module sub-commands appeared on Modules 5.
892892

893893
:subcmd:`sh-to-mod`
894894

895-
Starting Modules 5.1, this sub-command also tracks shell completion changes
896-
for bash, tcsh and fish shells.
895+
Starting Modules ``5.1``, this sub-command also tracks shell completion
896+
changes for bash, tcsh and fish shells.
897+
898+
Shell mode ``bash-eval`` is introduced on Modules version ``5.4``.
897899

898900
:subcmd:`source`
899901

@@ -1043,8 +1045,10 @@ The following modulefile Tcl commands appeared on Modules 5.
10431045

10441046
:mfcmd:`source-sh`
10451047

1046-
Starting Modules 5.1, this modulefile command also tracks shell completion
1047-
changes for bash, tcsh and fish shells.
1048+
Starting Modules ``5.1``, this modulefile command also tracks shell
1049+
completion changes for bash, tcsh and fish shells.
1050+
1051+
Shell mode ``bash-eval`` is introduced on Modules version ``5.4``.
10481052

10491053
:mfcmd:`unsetenv`
10501054

doc/source/design/source-shell-script-in-modulefile.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ Specification
211211
- A separator string ``%ModulesSubShToMod%`` is printed between each function definition not to get main and nested functions mixed up
212212
- Such sub-separator is only applied on fish shell
213213

214+
- ``bash-eval`` shell is added in version 5.4
215+
216+
- Instead of sourcing a bash shell script, execution output of this script is evaluated
217+
214218
- **FUTURE**: this feature may be extended to translate environment changes made by tools like Spack, Lmod or pkg-config. It may provide this way bridges between different realms.
215219

216220
.. vim:set tabstop=2 shiftwidth=2 expandtab autoindent:

doc/source/module.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2260,6 +2260,10 @@ Module Sub-Commands
22602260
The following shells are supported: sh, dash, csh, tcsh, bash, ksh, ksh93,
22612261
zsh and fish.
22622262

2263+
*Shell* could also be set to ``bash-eval``. In this mode, bash shell *script*
2264+
is not sourced but the output resulting from its execution is evaluated to
2265+
determine the environment changes it does.
2266+
22632267
.. only:: html
22642268

22652269
.. versionadded:: 4.6
@@ -2271,6 +2275,9 @@ Module Sub-Commands
22712275
Support for tracking shell completion changes on bash, tcsh and fish
22722276
shells added
22732277

2278+
.. versionchanged:: 5.4
2279+
Support for ``bash-eval`` shell mode added
2280+
22742281
.. subcmd:: show modulefile...
22752282

22762283
See :subcmd:`display`.

doc/source/modulefile.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,10 @@ the *modulefile* is being loaded.
12001200
The following shells are supported: sh, dash, csh, tcsh, bash, ksh, ksh93,
12011201
zsh and fish.
12021202

1203+
*Shell* could also be set to ``bash-eval``. In this mode, bash shell *script*
1204+
is not sourced but the output resulting from its execution is evaluated to
1205+
determine the environment changes it does.
1206+
12031207
.. only:: html
12041208

12051209
.. versionadded:: 4.6
@@ -1211,6 +1215,9 @@ the *modulefile* is being loaded.
12111215
Support for tracking shell completion changes on bash, tcsh and fish
12121216
shells added
12131217

1218+
.. versionchanged:: 5.4
1219+
Support for ``bash-eval`` shell mode added
1220+
12141221
.. mfcmd:: system string
12151222

12161223
Run *string* command through shell. On Unix, command is passed to the

0 commit comments

Comments
 (0)