Closed ofrei closed 1 day ago
Using functions might be the way to go:
funcPWD() { echo "$PWD"; }
export PYTHON="singularity exec --home funcPWD:/home $BIND ${MIXER_SIF} python"
I think there's no need to replace the system "pwd" function; this ought to work:
export PYTHON="singularity exec --home pwd:/home $BIND ${MIXER_SIF} python"
@espenhgn thanks!! This works very well. I've played further with functions, also tried with eval
, and also found that there is a pwd
command (https://askubuntu.com/questions/476572/difference-in-use-between-pwd-and-pwd), but still didn't realise that the fix is so nice and simple.
Mounting
$PWD:/home
is a handy trick that allows user to use relative path within current working directory while using containers . This works for both docker and singularity. This is an example of how to invoke mixer.py script:An issue with this command is that
$PWD
is evaluate when user defines MIXER_PY. Later user may change working directory, but${MIXER_PY}
will still mount an old folde.Is there a way of changing the above export commands so that $PWD is evaluated when we invoke $MIXER_PY ?