Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在.bashrc中设置chroot颜色_Bash - Fatal编程技术网

在.bashrc中设置chroot颜色

在.bashrc中设置chroot颜色,bash,Bash,我正试图微调我的.bashrc文件,并希望能使chroot成为一种不同于默认白色的颜色。我的rc文件非常接近默认值,除了一些git内容和着色方案。问题是,在调用debian_chroot之前,我似乎无法毫无问题地将chroot设置为红色。。以下是我认为相关内容的摘录 source ~/.git-prompt.sh if [ "$color_prompt"=yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]$

我正试图微调我的.bashrc文件,并希望能使chroot成为一种不同于默认白色的颜色。我的rc文件非常接近默认值,除了一些git内容和着色方案。问题是,在调用debian_chroot之前,我似乎无法毫无问题地将chroot设置为红色。。以下是我认为相关内容的摘录

source ~/.git-prompt.sh
if [ "$color_prompt"=yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]$(__git_ps1 "(%s)") '
    PS1="$PS1\[\033[00m\]\u@\h:\n\[\033[01;34m\]\w\[\033[00m\] \$ "
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w $(__git_ps1 "(%s)") \$ '
fi

# 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
unset color_prompt force_color_prompt

如何在bash提示符中将chroot颜色设置为红色?

我自己解决了这个问题。在我的例子中,我使用的是Python的localenv,它在/localenv/bin/中有自己的名为“activate”的rc类型文件。在(
basename\“VIRTUAL\u ENV\”
)将$PS1设置为PS1的行之前添加颜色。回答您自己的问题。