Skip to content

syntax error using bash 4.2 #14

orlandu63 opened this Issue Feb 19, 2011 · 5 comments

3 participants


Using the latest revision of this script as of the time of writing on bash 4.2, I receive a syntax error after every inputted command:

-bash: PROMPT_COMMAND: line 1: syntax error near unexpected token `;;'
-bash: PROMPT_COMMAND: line 1: `z --add "$(pwd -P 2>/dev/null)";; printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"'

By the way, the reported line number is completely arbitrary. It seems to increment after every command.


After thinking for a second it seems that this error isn't intrinsic to bash 4.2 but to my distribution's (Arch Linux) profile initialization scripts. However, I am not too familiar with the intricacies of such things. Can you confirm?

rupa commented Feb 20, 2011

Looks like something else is also setting PROMPT_COMMAND on your system and we aren't playing well together. It looks like the two semicolons are one from my script and one from whatever else is modifying PROMPT_COMMAND.

I didn't give a huge amount of thought to setting PROMPT_COMMAND besides making sure not to clobber anything that was already there, and this raises some issues to me and I think I can improve it.

In the meantime though - I have no idea what the other stuff is doing in your PROMPT_COMMAND - all the stuff after the two semicolons looks like stuff you would put in PS1, for your prompt. I dunno where that's coming from but it doesn't look right at all.

rupa commented Jul 10, 2011

closing due to age and lack of activity

@rupa rupa closed this Jul 10, 2011
Enlik commented Jul 10, 2011

see here:
(there are also some references in Arch's forum about the "broken" variable and problems with Autojump)
it should be already fixed.

rupa commented Jul 10, 2011

Oh that sucks. Thanks for the link - explains a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.