From c7b884057fca2c1c033325854bd29822e10c0e84 Mon Sep 17 00:00:00 2001 From: Adam McCartney Date: Tue, 24 Mar 2026 13:01:55 +0100 Subject: [PATCH 1/4] Make EESSI_MODULE_UPDATE_PS1 configurable Fixes https://github.com/EESSI/software-layer-scripts/issues/187 --- init/lmod/bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/lmod/bash b/init/lmod/bash index 54e37946..dcb3b4ac 100644 --- a/init/lmod/bash +++ b/init/lmod/bash @@ -93,7 +93,7 @@ if [ -z "$__Init_EESSI_Default_Modules" ]; then # (in an interactive shell PS1 is likely unset, so let's only do this if it is set) if [ -n "$PS1" ]; then export PS1 - export EESSI_MODULE_UPDATE_PS1=1 + export EESSI_MODULE_UPDATE_PS1=${EESSI_MODULE_UPDATE_PS1:-1} fi # Path to top-level module tree From bbf52f06213f8eb00ce80e6fab875df1545ed082 Mon Sep 17 00:00:00 2001 From: Adam McCartney Date: Tue, 24 Mar 2026 13:30:39 +0100 Subject: [PATCH 2/4] Works with check in EESSI module for bash --- init/lmod/bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/init/lmod/bash b/init/lmod/bash index dcb3b4ac..8b0fb097 100644 --- a/init/lmod/bash +++ b/init/lmod/bash @@ -93,7 +93,11 @@ if [ -z "$__Init_EESSI_Default_Modules" ]; then # (in an interactive shell PS1 is likely unset, so let's only do this if it is set) if [ -n "$PS1" ]; then export PS1 - export EESSI_MODULE_UPDATE_PS1=${EESSI_MODULE_UPDATE_PS1:-1} + if [ "$EESSI_MODULE_UPDATE_PS1" -eq "0" ]; then + unset EESSI_MODULE_UPDATE_PS1 + else + export EESSI_MODULE_UPDATE_PS1=1 + fi fi # Path to top-level module tree From 2e4760e5e56e2622551c3f0b7c20eb4024835fa5 Mon Sep 17 00:00:00 2001 From: Adam McCartney Date: Tue, 24 Mar 2026 13:33:33 +0100 Subject: [PATCH 3/4] Same fix for zsh (untested but should work the same) --- init/lmod/zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/init/lmod/zsh b/init/lmod/zsh index d2f603d2..fed9f8be 100644 --- a/init/lmod/zsh +++ b/init/lmod/zsh @@ -49,7 +49,11 @@ if [ -z "$__Init_EESSI_Default_Modules" ]; then # (in an interactive shell PS1 is likely unset, so let's only do this if it is set) if [ -n "$PS1" ]; then export PS1 - export EESSI_MODULE_UPDATE_PS1=1 + if [ "$EESSI_MODULE_UPDATE_PS1" -eq "0" ]; then + unset EESSI_MODULE_UPDATE_PS1 + else + export EESSI_MODULE_UPDATE_PS1=1 + fi fi # Path to top-level module tree From 12cd30a48070ecc3bca81c43b4126bfc230b2afe Mon Sep 17 00:00:00 2001 From: Adam McCartney Date: Tue, 24 Mar 2026 13:42:48 +0100 Subject: [PATCH 4/4] More robust check If the EESSI_MODULE_UPDATE_PS1 is set to "0", then don't update the prompt. --- init/lmod/bash | 2 +- init/lmod/zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/init/lmod/bash b/init/lmod/bash index 8b0fb097..e8d57636 100644 --- a/init/lmod/bash +++ b/init/lmod/bash @@ -93,7 +93,7 @@ if [ -z "$__Init_EESSI_Default_Modules" ]; then # (in an interactive shell PS1 is likely unset, so let's only do this if it is set) if [ -n "$PS1" ]; then export PS1 - if [ "$EESSI_MODULE_UPDATE_PS1" -eq "0" ]; then + if [ ! -z ${EESSI_MODULE_UPDATE_PS1} ] && [ ${EESSI_MODULE_UPDATE_PS1} -eq "0" ]; then unset EESSI_MODULE_UPDATE_PS1 else export EESSI_MODULE_UPDATE_PS1=1 diff --git a/init/lmod/zsh b/init/lmod/zsh index fed9f8be..45fc73a4 100644 --- a/init/lmod/zsh +++ b/init/lmod/zsh @@ -49,7 +49,7 @@ if [ -z "$__Init_EESSI_Default_Modules" ]; then # (in an interactive shell PS1 is likely unset, so let's only do this if it is set) if [ -n "$PS1" ]; then export PS1 - if [ "$EESSI_MODULE_UPDATE_PS1" -eq "0" ]; then + if [ ! -z ${EESSI_MODULE_UPDATE_PS1} ] && [ ${EESSI_MODULE_UPDATE_PS1} -eq "0" ]; then unset EESSI_MODULE_UPDATE_PS1 else export EESSI_MODULE_UPDATE_PS1=1