prompt bug fix
This commit is contained in:
+14
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user