Customize shell

I have a rather silly question, but I can’t figure it out.

I want to add some colors to my shell.

So from CLI I ran the following:

export PS1='\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;36m\]\h \[\033[01;33m\]\w \[\033[01;35m\]$ \[\033[00m\]'

This works perfectly, but it is only temporary. When I log out and back in, the colors are gone.

I’ve added the above to my /root/.bashrc file, but it just ends up giving the whole thing as prompt.

Any help will be appreciated.

First, one should avoid doing things as root.

Second, environment variables can be set in ~/.bash_profile (even though every interactive bash instance reads ~/.bashrc). I set most in .bash_profile

That said, I do have in ~/.bashrc

PS1="\\h:\\l:\\w\\$ "

(Note: no export) Fact: Quoting in script and command-line are not identical in behaviour.

If you want to set prompt for every account, then add a *.sh file into /etc/profile.d/

Thank you! Your solution worked.