2

Today I had to install a couple of applications (a Postgres client and other stuff) and I had to setup a few things like environment paths.

I had a couple of aliases working and they stopped working after that. They are set on ~/.bash_profile so I've run source ~/.bash_profile, but then I got my bash prompt messed up, like this:

enter image description here

This is the command within my bash_profile that generates it:

export PS1="\[${BOLD}${MAGENTA}\]\u \[$WHITE\]in \[$GREEN\]\w\[$WHITE\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[$PURPLE\]\$(parse_git_branch)\[$WHITE\]\n$symbol\[$RESET\]"

As you can see, the \[s and \]s are appearing, when they should not be displayed at all, and the \u, \n, and \w are not being replaced with the appropriate strings. But the colour changes are still working.

I'm a bit confused about what's going on here, any ideas?

  • 1
    What exactly is the problem, and what did you try to do ? – user264413 Dec 13 '17 at 16:38
  • Yeah you changed your PS1 variable and now the prompt look's different - change it back, or just type export PS1="> " to have a cleaner prompt. – chevallier Dec 13 '17 at 19:16
0

Seems like some expert thought it a good idea to obfuscate ANSI color codes in environment variables and use them in a custom prompt, meanwhile messing up the escape syntax, then setting the prompt "for you" without asking.

Comment out the PS1 line and you should get a default prompt. Or change it to something you prefer, but better don't rely on custom environment variables.

Related:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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