3
1
I am using ubuntu-10.04 and bash. I want to go into root and have it change my prompt to underlined red characters to reflect that I am in root. At the bash prompt, if I type:
$ sudo bash
then I go into root, however my prompt doesn't change. In /root/.bashrc
I have:
RED="\[\033[0;31m\]"
UNDERLINE="\[\033[4m\]"
DEFAULT="\[\033[0m\]"
export PS1=$RED$UNDERLINE'\u@\h:\w\$'$DEFAULT' '
however this file isn't being read. In order for it to be read I have to enter at the prompt:
# . /root/.bashrc
which I don't want to have to do. How do I set it up so that when I go into root, /root/.bashrc
runs automatically?
Sorry, I meant to say
sudo bash
. You're right,sudo root
is meaningless. Anyway, your suggestion of an if statement on the $UID works. – Philip Hunt – 2011-04-10T11:58:53.030@Philip: If an answer is helpful, consider marking it as accepted.
– user1686 – 2011-04-10T12:07:06.583