prompt bug fix

This commit is contained in:
2026-10-13 14:35:00 +02:00
parent 9e96aaa411
commit afe1a1b610
5 changed files with 358 additions and 239 deletions
+14 -2
View File
@@ -278,10 +278,22 @@ parse_conf()
value="${value//\`/}"
value="${value//\$\(/}"
# Correctly interpretet internal variables (e.g. $HOME)
# Correctly interpretet internal variables (e.g. $HOME). In the
# [prompt] section only the variables that exist are substituted:
# envsubst would otherwise replace an unknown one by nothing,
# wiping out the $Blue-style colour references that are resolved
# later, when the colour variables exist (see prompt.sh).
if [[ "$value" == *\$* ]]; then
if command -v envsubst >/dev/null 2>&1; then
value=$(envsubst <<< "$value")
if [[ "$current_section" == "prompt" ]]; then
local _envnames="" _envname
for _envname in $(compgen -e); do
[[ "$_envname" =~ ^[A-Za-z_][A-Za-z0-9_]*$ ]] && _envnames+="\${${_envname}}"
done
value=$(envsubst "$_envnames" <<< "$value")
else
value=$(envsubst <<< "$value")
fi
fi
# If envsubst is unavailable, $VAR references are left as-is.
fi