Repository navigation
shell-integration: bash: PROMPT_COMMAND: line 0: syntax error near unexpected token ;;' when PROMPT_COMMAND already ends in ;
#11245
Issue DescriptionBefore every bash: PROMPT_COMMAND: line 0: syntax error near unexpected token `;;'
bash: PROMPT_COMMAND: line 0: `_opam_env_hook;; __ghostty_hook'
Notes:
The diff -u \
<(curl https://raw.githubusercontent.com/ghostty-org/ghostty/2d347cad336b6d4bd461f33fe87d90e6aa269843/src/shell-integration/bash/ghostty.bash) \
${GHOSTTY_RESOURCES_DIR}/shell-integration/bash/ghostty.bash | deltaExpected BehaviorNo Actual Behavior
bash: PROMPT_COMMAND: line 0: syntax error near unexpected token `;;'
bash: PROMPT_COMMAND: line 0: `_opam_env_hook;; __ghostty_hook'
Reproduction Steps
bash: PROMPT_COMMAND: line 0: syntax error near unexpected token `;;'
bash: PROMPT_COMMAND: line 0: `_opam_env_hook;; __ghostty_hook'Ghostty LogsGhostty VersionOS Version InformationmacOS Sequoia 15.7.4 (24G517) arm64 (Linux only) Display ServerNone (Linux only) Desktop Environment/Window ManagerNo response Minimal Ghostty Configurationshell-integration = bashAdditional Relevant Configuration
|
Replies: 4 comments 5 replies
|
Hello there, I put some debug things in ghostty.bash to understand (starting line 295): # Append our hook to PROMPT_COMMAND, preserving its existing type.
# shellcheck disable=SC2128,SC2178,SC2179
set -x
if [[ ";${PROMPT_COMMAND[*]:-};" != *";__ghostty_hook;"* ]]; then
if [[ -z "${PROMPT_COMMAND[*]}" ]]; then
if (( BASH_VERSINFO[0] > 5 || (BASH_VERSINFO[0] == 5 && BASH_VERSINFO[1] >= 1) )); then
PROMPT_COMMAND=(__ghostty_hook)
else
PROMPT_COMMAND="__ghostty_hook"
fi
elif [[ $(builtin declare -p PROMPT_COMMAND 2>/dev/null) == "declare -a "* ]]; then
PROMPT_COMMAND+=(__ghostty_hook)
else
[[ "${PROMPT_COMMAND}" =~ \;[[:space:]]*$ ]] || PROMPT_COMMAND+=";"
PROMPT_COMMAND+=" __ghostty_hook"
fi
fi
echo "DEBUG: PROMPT_COMMAND:'$PROMPT_COMMAND'"
set +xAnd this is the output so you can see that PROMPT_COMMAND is somewhat buggy: |
|
There looks like another scenario that breaks the intergration: starting a subshell (using kubie). Starting from 1.3.0, I now get this: When I check the subshell, I see that When I clear out my I've check the previous version, and I can confirm that the error didn't happen in 1.2.0. I can source the shell integration from |


Fixed by #11260