[nSLUG] "Switchable" bash prompt (change color for root)
jwark at eastlink.ca
Tue Mar 9 15:22:29 AST 2010
I presume that you use su to switch to root.
Doesn't root's .bashrc get sourced when you do that? Mine certainly
does, although I use bash as both my normal user and root user shells.
You would then just have to set up your PS1 environment variable to
whatever you want in root's .bashrc, following Jason's suggestion re
Jason Kenney wrote:
> Years ago this was part of the default gentoo .bashrc
> You can probably find a copy of that floating around if you'd like a
> more tested implementation, but there would be countless ways to do
> - man whoami
> - man id
> - echo $EUID
> There are many tutorials on using ascii coloring in prompts if you're
> not sure how to do that bit too.
> On Tue, Mar 9, 2010 at 10:22 AM, InverseCow <rowan.townshend at gmail.com> wrote:
>> Hi everyone, I would like to add some functionality to my .bashrc at work,
>> to differentiate between when I am working as "myself" (uid=94307) and when
>> I switch up to "root" (uid=0). Specifically I would like to change the color
>> on my prompt to reflect the change. What would be an elegant way to handle
>> this? My default shell is KSH (environmental standard), and I switch over to
>> BASH before I get a prompt (minor KSH .file hack). I've attached a hacked
>> down .bashrc that I use for reference (bashrc_rowan.txt).
>> "Just because I have a burnt face, doesn't mean I can't fight crime!" --
>> View this message in context: "Switchable" bash prompt (change color for
>> Sent from the nSLUG mailing list archive at Nabble.com.
>> nSLUG mailing list
>> nSLUG at nslug.ns.ca
> nSLUG mailing list
> nSLUG at nslug.ns.ca
Jack Warkentin, phone 902-404-0457, email jwark at eastlink.ca
39 Inverness Avenue, Halifax, Nova Scotia, Canada, B3P 1X6
More information about the nSLUG