From 004b471d9d90ab3805f6d7711d52f96a359a597f Mon Sep 17 00:00:00 2001 From: mrjk Date: Mon, 17 Apr 2023 14:40:55 -0400 Subject: [PATCH] fix: PS1 handling --- lib/idmgr_mod_ps1.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/idmgr_mod_ps1.sh b/lib/idmgr_mod_ps1.sh index d68914e..770425c 100644 --- a/lib/idmgr_mod_ps1.sh +++ b/lib/idmgr_mod_ps1.sh @@ -41,10 +41,10 @@ idm_ps1__enable () # Detect is PS1_*FIX vars exists if [ "${PS1_PREFIX+x}" == x ]; then - >&2 echo "Suffixx: ${PS1_PREFIX+x}" + #>&2 echo "Prefix PS1_PREFIX: ${PS1_PREFIX+x}" idm_ps1__enable_suffix $@ else - >&2 echo "Classic: ${PS1_PREFIX+x}" + #>&2 echo "Classic PS1: ${PS1_PREFIX+x}" idm_ps1__enable_raw $@ fi @@ -66,13 +66,20 @@ idm_ps1__enable_suffix () { local id=${1} id="\033[0;34m($id)\033[00m" - echo "export PS1_PREFIX=\"$id $PS1_PREFIX\"" + echo "export PS1_PREFIX=\"$id${PS1_PREFIX:+ $PS1_PREFIX}\"" } idm_ps1__disable () { - echo "export PS1=\"\${IDM_SHELL_PS1}\"" - return + + # Detect is PS1_*FIX vars exists + if [ "${PS1_PREFIX+x}" == x ]; then + #>&2 echo "Prefix PS1_PREFIX: ${PS1_PREFIX+x}" + echo "unset PS1_PREFIX" + else + #>&2 echo "Classic PS1: ${PS1_PREFIX+x}" + echo "export PS1=\"\${IDM_SHELL_PS1}\"" + fi } idm_ps1__kill () { idm_ps1__disable ${@-}; }