1

I'm using OS X Yosemite 10.10.5. When using the default /bin/bash as your login shell, setting the following in .profile:

PROMPT_COMMAND='echo -ne "\033]0;${PWD/$HOME/~}\007"'

sets the Terminal tab title to ~ when you are in your home directory, or ~/sub/dir when in subdirectories.

However, Yosemite ships with bash version 3, and I prefer version 4, so I added /opt/local/bin/bash (which is version 4.3.42) to /etc/shells and used the chsh command to set my login shell to the MacPorts version. Everything else works fine, but when in my home directory, the tab title displays /Users/mattdmo instead of ~.

Did the PROMPT_COMMAND syntax change with version 4? How do I get the functionality I'm looking for? On my Linux (Ubuntu 15.04) VM, I'm using bash 4 and the same command works fine...

2

This works (i.e. escape the ~):

PROMPT_COMMAND='echo -ne "\033]0;${PWD/$HOME/\~}\007"'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.