|
| 1 | +.. _envml(1): |
| 2 | + |
| 3 | +envml |
| 4 | +===== |
| 5 | + |
| 6 | +SYNOPSIS |
| 7 | +-------- |
| 8 | + |
| 9 | +**envml** [*MODULE_ACTION*]... [--] *COMMAND* [*ARG*]... |
| 10 | + |
| 11 | +DESCRIPTION |
| 12 | +----------- |
| 13 | + |
| 14 | +The :command:`envml` command is a helper script that configures the shell |
| 15 | +environment using specified Environment Modules actions before executing a |
| 16 | +given command. |
| 17 | + |
| 18 | +This is useful for running a command in a modified environment without |
| 19 | +permanently altering the current shell session. |
| 20 | + |
| 21 | +The script first interprets arguments as module actions, then switches to |
| 22 | +command execution after either encountering ``--`` or determining that the |
| 23 | +remaining arguments form the actual command to run. |
| 24 | + |
| 25 | +MODULE_ACTION FORMAT |
| 26 | +-------------------- |
| 27 | + |
| 28 | +Each module action argument can be one of the following forms: |
| 29 | + |
| 30 | +- ``purge`` |
| 31 | + Unload all currently loaded modulefiles. |
| 32 | + |
| 33 | +- ``restore[=coll]`` |
| 34 | + Restore the module environment from the named collection ``coll``. If no |
| 35 | + name is given, restores the default collection. |
| 36 | + |
| 37 | +- ``unload=mod1[&mod2...]`` |
| 38 | + Unload one or more specified modulefiles. |
| 39 | + |
| 40 | +- ``switch=mod1&mod2`` |
| 41 | + Unload ``mod1`` and load ``mod2``. |
| 42 | + |
| 43 | +- ``[load=]mod1[&mod2...]`` |
| 44 | + Load one or more specified modulefiles. ``load=`` can be omitted. |
| 45 | + |
| 46 | +Multiple MODULE_ACTIONs can be passed in a single argument using the colon |
| 47 | +(``:``) separator. The ampersand (``&``) is used to specify multiple modules |
| 48 | +in a single action. |
| 49 | + |
| 50 | +COMMAND EXECUTION |
| 51 | +----------------- |
| 52 | + |
| 53 | +Everything following the ``--`` separator is treated as the command to execute |
| 54 | +in the modified environment. |
| 55 | + |
| 56 | +If no ``--`` separator is provided, :command:`envml` assumes the first |
| 57 | +argument is a MODULE_ACTION and the remaining arguments form the command to |
| 58 | +execute. |
| 59 | + |
| 60 | +OPTIONS |
| 61 | +------- |
| 62 | + |
| 63 | +.. option:: --help, -h |
| 64 | + |
| 65 | + Display usage information and exit. |
| 66 | + |
| 67 | +EXAMPLES |
| 68 | +-------- |
| 69 | + |
| 70 | +Run ``command arg1 arg2`` in the environment restored from the default module |
| 71 | +collection: |
| 72 | + |
| 73 | +.. code-block:: sh |
| 74 | +
|
| 75 | + envml restore command arg1 arg2 |
| 76 | +
|
| 77 | +Purge all modules, then load ``mod1`` and ``mod2``, and run the command: |
| 78 | + |
| 79 | +.. code-block:: sh |
| 80 | +
|
| 81 | + envml purge:mod1:mod2 command arg1 arg2 |
| 82 | +
|
| 83 | +Use the ``--`` separator to avoid ambiguity: |
| 84 | + |
| 85 | +.. code-block:: sh |
| 86 | +
|
| 87 | + envml restore load=mod1&mod2 -- command arg1 arg2 |
| 88 | +
|
| 89 | +EXIT STATUS |
| 90 | +----------- |
| 91 | + |
| 92 | +The :command:`envml` command returns the exit status of the executed command |
| 93 | +or ``1`` if module action fails. |
| 94 | + |
| 95 | +DIAGNOSTICS |
| 96 | +----------- |
| 97 | + |
| 98 | +If the :command:`module` command is not available in the shell (i.e., not a |
| 99 | +shell function), :command:`envml` will print an error and exit. |
| 100 | + |
| 101 | +SEE ALSO |
| 102 | +-------- |
| 103 | + |
| 104 | +:ref:`module(1)`, :ref:`ml(1)`, :ref:`modulefile(5)` |
0 commit comments