if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@${os_release_name}\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@${os_release_name}:\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@${os_release_name}: \w\a\]$PS1"
;;
*)
;;
esac
Distrobox 子系统功能很好用,但有一个问题比较糟心,
所有的子系统都用一样的终端,经常不知道自己在哪里做事。
于是有以下简易办法。
警告,修改前注意备份。
修改.bashrc,在PS1相关代码前加上:
然后将所有PS1中的
\h
(电脑名)替换为${os_release_name}
(发行版名)。保存后再次打开终端,结果:
替换后的PS1部分(供参考,自己改,不要复制我这个):