小编fre*_*rik的帖子

为什么我的自定义提示在 Windows 10 上的 Ubuntu/Bash 中不显示?

~/.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,它就可以工作。但我不想破坏自定义。

bash windows-subsystem-for-linux

3
推荐指数
1
解决办法
2009
查看次数

标签 统计

bash ×1

windows-subsystem-for-linux ×1