Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 11-22-2003, 11:46 AM   #1
Registered: Jul 2003
Location: Sunny Florida, USA
Distribution: Ubuntu 6.06 LTS
Posts: 53

Rep: Reputation: 15
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 ]
export PS1="\[\e[37;1;41m\]\h:\w [\!]\$>\[\e[0m\]"
export PS1="\h:\w [\!]\$> "

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 Oh Well, you learn Thanks to all who responded.

Last edited by gandalf2041; 11-22-2003 at 01:52 PM.
Old 11-22-2003, 01:37 PM   #2
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927Reputation: 927
If it's set executable try:

ln -s .bashrc .bash_login



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
newbie question: whats the difference between "su root", "su" and "su -&quo mojarron Slackware 9 12-07-2009 04:08 PM
[Redhat] make "admin" account same privledges as "root" Bi0haZarD Linux - Networking 20 01-12-2005 10:47 AM
can't "su -" to root after changing /etc/passwd dzz Linux - Security 2 11-05-2004 01:39 PM
Hard drive lose dma "on the fly" Hammett Linux - Hardware 4 08-23-2004 01:38 PM
Tiny Sofa 2.0 - I thought "halt", "reboot" were only root command ?? sorcerer Linux - Distributions 1 08-21-2004 03:28 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:21 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration