我注意到其中~/.bashrc
有两组PS1
:
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$'
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h:\w\a\]$PS1"
;;
*)
;;
esac
第一个检查是否为$color_prompt
真,并确定提示文本。
第二个检查$TERM
并确定标题。
但是它们两个都更改了相同的环境变量,因此,当终端启动并“看到”PS1
为提示文本设置的内容时,它又如何设置标题?被~/.bashrc
加载两次?
第一个条件$PS1
根据是否$color_prompt
启用进行设置。第二个分配的扩展了此方法,方法是将设置$PS1
为,其中包含的先前值$PS1
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h:\w\a\]$PS1"
# Here ---------------------------------------------------^
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句