Skip to content

Commit 44084ce

Browse files
authored
Merge pull request #372 from DrDaveD/clarify-bash
Clarify use of bash features
2 parents e6c3b46 + 99f5b7d commit 44084ce

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

definition_files.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,15 +589,20 @@ information about the {Project} container environment.
589589
function definitions and aliases do not get carried through.
590590
As a result, for example initializing conda cannot be done there.
591591

592-
For that type of initialization in non-interactive shells you can in
592+
For that type of initialization you can take advantage of some bash
593+
features, if the container includes bash (for example alpine does not
594+
include bash). Apptainer by default will use bash if it is available.
595+
For non-interactive shells you can in
593596
the ``%environment`` section export ``BASH_ENV`` to point to a script to
594-
source when the shell starts.
597+
source when the child shell starts.
598+
Note that bash by default does not process aliases in non-interactive
599+
shells, unless ``shopt -s expand_aliases`` is used before they are defined.
595600

596601
For the equivalent in interactive shells you can instead in the ``%post``
597602
section add to ``/etc/bash.bashrc`` on Debian-based distributions.
598603
(RedHat-based distributions have a /etc/bashrc that apparently once
599604
was equivalent but it does not appear to work in current versions.)
600-
In addition, by default the ``shell`` command starts the shell
605+
In addition, by default the ``shell`` command starts bash
601606
with a ``--norc`` option so it does not run any bashrc.
602607
That can be worked around by adding
603608
``export SINGULARITY_SHELL=/bin/bash`` in the ``%environment``

0 commit comments

Comments
 (0)