Why doesn’t my bash prompt update?

You need a backslash on the $ so it isn’t expanded immediately. (Compare to the `...`, which is a different way of writing $(...).)

export PS1="${RESET}${YELLOW}\u@\h${NORMAL} \`${SELECT}\` ${YELLOW}\w \$(__git_ps1) >${NORMAL} "

I would agree with @MikeSep about using single quotes, but it’s actually a bit more optimal to let the colors and such be substituted immediately. Not necessary, just somewhat better. That said, it is easier to understand what’s going on if you use the single quotes.

Leave a Comment