简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM