1

I am following the Udacity course where in Lesson 1 video 29. they talk about customizing the git bash and setting up workspace.

I did dig into how the .bash_profile should be edited and it almost works as I want it. Except I can't figure out how to add a new line in front of the command prompt $ sign.

TITLESTRING="Bash Prompt (Git for Windows) =>"
TITLE="\[\033]0;$TITLESTRING${PWD//[^[:ascii:]]/?}\007\]"
export PS1="$TITLE\n$GREEN\u@\h$MAGENTA\$(__git_ps1) $LIGHT_YELLOW\w $RESET\n$ "

When I put the \n before the last $ sign in order to make it appear in the next line, then I get this error message on starting git bash:

bash: command substitution: line 1: syntax error near unexpected token `)'
bash: command substitution: line 1: `__git_ps1)'

Mik@BIG_PC~
$

When I don't have that \n in front of the last $ sign then all is good.

Please help me whit this.

2
  • \\n .. just guessing.
    – Rufinus
    Commented May 7, 2017 at 16:41
  • I have already tried that. In many possible combination.
    – Bar6
    Commented May 7, 2017 at 16:48

1 Answer 1

0

It seems to be working if you are using $(__git_ps1), not \$(__git_ps1).

I get:

vonc@bvonc (master) ~/data/git/git
$ git version
git version 2.12.1.windows.1

You can see many other examples of $(__git_ps1) usage in "PS1 line with git current branch and colors", and I never see \$(...).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.