我正在尝试screen设置我的xterm标题。我在 之外工作screen,但screen在我开始时保留任何标题。这是我的.bashrc:
函数 bash_prompt_command() {
# $PWD 应该保留多少个字符
本地 pwdmaxlen=25
# 表示有dir truncation
本地 trunc_symbol=".."
本地目录=${PWD##*/}
pwdmaxlen=$(( ( pwdmaxlen < ${#dir} ) ? ${#dir} : pwdmaxlen ))
NEW_PWD=${PWD/#$HOME/\~}
本地 pwdoffset=$(( ${#NEW_PWD} - pwdmaxlen ))
如果 [ ${pwdoffset} -gt "0" ]
然后
NEW_PWD=${NEW_PWD:$pwdoffset:$pwdmaxlen}
NEW_PWD=${trunc_symbol}/${NEW_PWD#*/}
菲
导出 NEW_PWD
}
PROMPT_COMMAND=bash_prompt_command
# 颜色图表@ http://wiki.archlinux.org/index.php/Color_Bash_Prompt
案例“${TERM}”在
"xterm")
标题栏='\[\033]0;\u@\h > ${NEW_PWD}\007\]'
PS1="${TITLEBAR}\[\e[1;32m\][\e[0;36m\]\u\e[1;32m\]@\e[1;33m\]\h\e[ 1;32m\]] \e[0;37m\]\${NEW_PWD}/ \e[1;32m\]\$ \[\e[0m"
;;
“屏幕”)
标题栏='\[\033]0;\u@\h > ${NEW_PWD}\007\]'
ESC='\[\ek\e\\\]'
PS1="${TITLEBAR}\[\e[1;32m\][\e[0;36m\]\u\e[1;32m\]] \e[0;37m\]\${NEW_PWD} / …