I am trying to set my user prompt in the Git for Windows Bash prompt. Here's a (very simple) prompt that works:
# \@ Prints the time: 11:14 AM
# \w Prints the full cwd path
# $(__git_ps1 ...) Prints the current git branch
PS1='\n[\@] \w $(__git_ps1 "(%s)") \$ '
As soon as I add a second newline character into the mix, I get the following error:
bash: command substitution: line 1: syntax error near unexpected token ')'
bash: command substitution: line 1: `__git_ps1 "(%s)")'
The variant of the prompt that throws this error is (note the newline before the $
prompt):
PS1='\n[\@] \w $(__git_ps1 "(%s)") \n\$ '
I'm thinking there must be an issue with the __git_ps1
routine that's causing this issue to occur, but I don't really understand it. Is there something simple here that I'm missing?