Open new Terminal tab in current working directory doesn’t work

terminal

In the Terminal preferences you can find an option to open new windows and tabs in the current working directory. Yet there's a message that says that programs notify Terminal about the current working directory using scape sequences, which I don't know what it means. But the Terminal itself is not doing this, as I would like to create a new tab when I press ⌘+T to open at the same working directory (not ~/). I found this post but it doesn't address this. Here you have a figure with the options:enter image description here

Best Answer

So I found the problem with the Terminal and I'm posting the answer hoping it can help others. The problem was in the definition of the PROMPT_COMMAND environmental variable. I changed its definition from

export PROMPT_COMMAND='history -n;'

to

export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ;} history -n"

appending at the end of the existing PROMPT_COMMAND instead and this solved the problem.