git bash在windows(mingw64)编辑.bash_profile ps1
问题描述:
我跟随第1课视频中的Udacity课程29.他们谈论定制git bash和设置工作区。git bash在windows(mingw64)编辑.bash_profile ps1
我已经深入了解.bash_profile应该如何编辑,它几乎可以按照我的需要进行工作。除了我不知道如何在命令提示符$ sign之前添加新行。
TITLESTRING="Bash Prompt (Git for Windows) =>"
TITLE="\[\033]0;$TITLESTRING${PWD//[^[:ascii:]]/?}\007\]"
export PS1="$TITLE\n$GREEN\[email protected]\h$MAGENTA\$(__git_ps1) $LIGHT_YELLOW\w $RESET\n$ "
当我把\ n,以使它出现在下一行的最后一个$符号前,然后我得到关于启动git的庆典此错误消息:
bash: command substitution: line 1: syntax error near unexpected token `)'
bash: command substitution: line 1: `__git_ps1)'
[email protected]_PC~
$
当我不在最后的$符号前没有\ n那么一切都很好。
请帮助我这个。
答
这似乎是工作,如果您使用$(__git_ps1)
,而不是\$(__git_ps1)
。
我得到:
[email protected] (master) ~/data/git/git
$ git version
git version 2.12.1.windows.1
你可以看到$许多其他的例子(__ git_ps1)使用在 “PS1 line with git current branch and colors”,我从来没有看到\$(...)
。
'\\ n' ..只是猜测。 – Rufinus
我已经试过了。在许多可能的组合中。 – Bar6