bash: recognize attributed prompt command arrays

Bash includes additional variable attributes in declare output, so an
exported indexed array is reported with an -ax prefix instead of -a.
Match the indexed-array prefix without requiring a following space so
these values continue through the array-preserving path.
This commit is contained in:
Jon Parise
2026-09-15 20:43:59 -04:00
parent 4dfa44ecd9
commit ed7f046ee4

View File

@@ -255,7 +255,7 @@ if (( BASH_VERSINFO[0] > 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 4) )
else
PROMPT_COMMAND="__ghostty_hook 2>/dev/null"
fi
elif [[ $(builtin declare -p PROMPT_COMMAND 2>/dev/null) == "declare -a "* ]]; then
elif [[ $(builtin declare -p PROMPT_COMMAND 2>/dev/null) == "declare -a"* ]]; then
PROMPT_COMMAND+=("__ghostty_hook 2>/dev/null")
else
[[ "${PROMPT_COMMAND}" =~ (\;[[:space:]]*|$'\n')$ ]] || PROMPT_COMMAND+=";"