mkporkodi
mkporkodi

Reputation: 81

Colors for my prompt set in my .bashrc do not appear when I open a new terminal, but only when I source it again. How do I fix this?

I make my prompt git aware and with colors in my ~/.bashrc, but when I open a new non-login shell it is all white. If I echo something in my ~/.bashrc I am able to see it. So my bashrc is actually being run but I suspect something runs after it that resets things. How do I identify which file this is. The colors appear only when I source ~/.bashrc so my ~/.bashrc itself seems to be working fine.

Upvotes: 3

Views: 638

Answers (1)

mkporkodi
mkporkodi

Reputation: 81

Thanks for your thoughts. The real issue was with my ~/.bashrc. I had been checking if my terminal was a color terminal before I executed the git-aware prompt and setting colors, but I did my export TERM=term-color only at the end. So it was working fine when my ~/.bashrc was sourced twice instead of once. Now that I moved the export to the top, it was working fine.

Upvotes: 1

Related Questions