Terminal tab title not working correctly with MacPorts bash

MattDMo

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...

Ilari Scheinin

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

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

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Set title for each terminal tab in gnome-terminal using a bash script

分類Dev

Commands Working In Terminal, But Not In Bash Script

分類Dev

Change the current terminal tab title inside a shell script

分類Dev

Can bash (or a terminal) auto-complete (tab-complete) from terminal buffer contents?

分類Dev

Set Tab Title to your current working directory instead of the current job name in zsh iterms

分類Dev

How to change Navigationbar title irrespective of Tab title

分類Dev

JsonView not working correctly with Spring

分類Dev

JsonView not working correctly with Spring

分類Dev

IF condition not working correctly

分類Dev

Format Table not working correctly

分類Dev

Angularjs routing not working correctly

分類Dev

jQuery settimeout() not working correctly

分類Dev

Base tag not working correctly

分類Dev

Laravel routing not working correctly

分類Dev

Codeigniter - Pagination not working correctly

分類Dev

Outlook Rule Not Working Correctly

分類Dev

Javascript function not working correctly

分類Dev

bash tab completion with spaces

分類Dev

Terminal: remember working directory

分類Dev

terminal + ssh doesn't display UTF correctly

分類Dev

Checkbox check all is not working correctly

分類Dev

Mobile nav not working correctly on Safari

分類Dev

Foreach loop position not working correctly

分類Dev

display:none not correctly working on mobile

分類Dev

flutter buttomNavigationBar not displaying or working correctly

分類Dev

Foreach loop on XPathNodeIterator not working correctly

分類Dev

Vim colors not working properly in terminal

分類Dev

Telnet server terminal support not working

分類Dev

New Terminal bash file error

Related 関連記事

ホットタグ

アーカイブ