mrxvt >
Note: If you use bash version 3.1 or later, then keep in mind that a few distributions set PROMPT_COMMAND in a manner that destroys the current tab title. You should either unset it, or set it to something useful. The following code snippet sets the tab title to the current command, and sets PROMPT_COMMAND to set your bash prompt to include a shortened version (3 path components) of the working directory in your shell prompt.
for ~/․bashrc
# Function to set tab title function set_title() { [[ "$BASH_COMMAND" == "$PROMPT_COMMAND" ]] && return echo -ne "\e]0;" > /dev/stderr [[ $USER == root ]] && echo -nE "su -- " > /dev/stderr echo -nE "$BASH_COMMAND (${PWD/#$HOME/~})" > /dev/stderr echo -ne "\a" > /dev/stderr } # Function to set shell prompt function set_prompt() { # Also set the command prompt to only expand the last three directories local pwdtail=${PWD/#$HOME/\~} [[ $pwdtail =~ ^(/[^/]+|~)/.+/([^/]+/[^/]+)$ ]] && \ pwdtail="${BASH_REMATCH[1]}/.../${BASH_REMATCH[2]}" PS1="${PS1_HEAD}${pwdtail}${PS1_TAIL}" } # Set shell prompt PS1_HEAD= if [[ -n $SSH_CONNECTION ]]; then PS1_HEAD+='\[\e[33m\]' [[ $USER == "root" ]] && PS1_HEAD+="root@" PS1_HEAD+='\h:' else [[ $USER == "root" ]] && PS1_HEAD+='\[\e[33m\]root:' fi PS1_HEAD+='\[\e[32m\]' PS1_TAIL='\[\e[0m\]$ ' PROMPT_COMMAND=set_prompt # Change the window title of X terminals if [[ $TERM =~ "xterm|rxvt" ]]; then # set -o functrace trap 'set_title' DEBUG fi
Make sure it is only read by interactive shells. E.g. in the beginning of ~/․bashrc do something like:
[[ $- != *i* ]] && return

Carving this off to fix a 403 forbidden error; sigh.