Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Avoid competing Terminal window title commands Apps
Note to self: if you're trying to set a terminal's name via File -> Set Title..., then by all means, please be sure that your /etc/bashrc file does NOT contain code similar to the following:

PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}:${PWD}\007"'
If the code is present, then with certainty, the next time you launch the Terminal, that code will override the setting made using the Terminal app itself and equally certain, hours will be lost, heads will be scratched, and much frustration will ensue as you try to figure out what's going on.

On the other hand, don't underestimate the power of this technique; if you would like dynamic terminal titles based on the current working directory or remote host, they can be easily configured.
    •    
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[4,308 views]  

Avoid competing Terminal window title commands | 3 comments | Create New Account
Click here to return to the 'Avoid competing Terminal window title commands' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Terminal titles in Panther: two problems
Authored by: hysterion on Nov 16, '03 03:49:17PM
A side note: The hint you link ("Display current jobs in Terminal titles") did something which is generally not considered not doable in bash, the new default shell -- see e.g.
X-Term Title Howto, ยง5.3
No postcmd hook in bash
On the plus side, Panther's Terminal introduces a setting which does almost that (Terminal > Window Settings... > Window > "Active Process Name" > Use Settings as Default). On the minus side...
  1. It's not quite as useful. E.g., with the previous hint, is you open man pages in a bunch of Terminal windows using man foo | cat, these strings are kept as titles and allow easy access from the Dock or Window menu. But now they all just say 'bash'. Anyone found how to recover the old behavior by hacking this new(?) Terminal hook? (I'm not optimistic.)
  2. The Settings window lets one add a static title part, which by default is "Terminal". I'd rather set this to empty (all it does is take space), but then "Terminal --" seems to return in every new window. Workaround?


[ Reply to This | # ]
Terminal titles in Panther: two problems
Authored by: wgscott on Nov 16, '03 05:22:03PM
Here's how I customize both terminal and iTerm for zsh (which should work for bash) and tcsh:

[ Reply to This | # ]
Terminal titles in Panther: two problems
Authored by: hysterion on Nov 16, '03 06:36:39PM

But you don't get "current job" titles in bash, do you? (Or I missed it.)



[ Reply to This | # ]