我~/.bash_profile在“Windows 上的 Ubuntu 上的 Bash”中添加了这个(我已经git安装了):
# Get the Git branch
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# Custom bash prompt
#
# Includes custom character for the prompt, path, and Git branch name.
#
# Source: kirsle.net/wizards/ps1.html
export PS1="\n\[$(tput bold)\]\[$(tput setaf 5)\] \[$(tput setaf 6)\]\w\[$(tput setaf 3)\]\$(parse_git_branch) \[$(tput sgr0)\]"
Run Code Online (Sandbox Code Playgroud)
进入新的 bash shell 时,我看不到此更改生效。我究竟做错了什么?
我~/.bashrc的未受影响并处于默认状态。
如果我将上面的代码添加到~/.bashrc,它就可以工作。但我不想破坏自定义。