LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Changing PS1 "on the fly" for root (https://www.linuxquestions.org/questions/linux-general-1/changing-ps1-on-the-fly-for-root-118880/)

gandalf2041 11-22-2003 11:46 AM

SOLVED: Changing PS1 "on the fly" for root
 
I have the following entry in my .bashrc which changes the prompt to a red background with white text when I am root.

if [ "$UID" = 0 ]
then
export PS1="\[\e[37;1;41m\]\h:\w [\!]\$>\[\e[0m\]"
else
export PS1="\h:\w [\!]\$> "
fi

the problem is I have to source .bashrc each time I switch users. Is there a way to make this happen upon switching users "on the fly"?

UPDATE: The solution was as simple as moving the definition to the /etc/bashrc :rolleyes: Oh Well, you live...you learn ;) Thanks to all who responded.

Tinkster 11-22-2003 01:37 PM

If it's set executable try:

ln -s .bashrc .bash_login

Cheers,
Tink


All times are GMT -5. The time now is 05:14 AM.