GNOME 2.0 Desktop for the Solaris Operating Environment Troubleshooting Guide

5.1 Dynamically-Set Title Does Not Work


Bug ID 4855527, Terminal.

In the Editing profile window, Title and Command tab, the menu options for the drop-down menu Dynamically-set title do not work. Terminal uses the following bash shell environment variable to set the dynamically-set title and the shell prompt:

PROMPT_COMMAND=$'echo -ne "\\033]0;${USER}@${HOSTNAME}: ${PWD}\\007"' PS1=$'[\\u@\\h \\W]\\$ ' USER=`id -un`

On Linux /etc/bashrc sets the required environment variables, but does not set these variables for the Solaris operating environment. Hence, the dynamically-set title and the shell prompt do not work in the Solaris operating environment.


As a workaround you can set the required environment variable by executing scripts for the various shells. 

bash shell: 

Set the following in bashrc:

case $TERM in
             PS1="\[\033]0;\u@\h: \w\007\]bash\\$ "
             PS1="bash\\$ "


USER=`/usr/xpg4/bin/id -un`
export USER

PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'

ksh shell: 

Add the following in the ~.profile file:

mycd () {
cd "${@}"; echo "\033]0;${USER}@${HOSTNAME}: ${PWD}\007\c"
alias cd=mycd

csh shell: 

Set the following in cshrc:

switch ($TERM)
         case "xterm*":
             set host=`hostname`
             alias cd 'cd \!*; echo -n "^[]0;${user}@${host}:
${cwd}^Gcsh% "'
             set prompt='csh% '

The '^[' and '^G' characters in the prompt string are single characters for ESC and BEL. You can enter these characters using Ctrl+v+ESC and Ctrl+v+g.