Customizing XFCE4-terminal - Command Prompt Color Issue

Swerved

Member
Ok.. So I decided to customize the xfce terminal on one of my machines (Xubuntu). I have been setting up text colors in .bashrc, but I am having a bit of a hard time setting it up so that when I do
Code:
sudo su
or log in as root, to set the text color to what I want... I actually started with the .bashrc from MX Linux because I liked the colors in xfce4-terminal it uses. It works fine, except for this one thing... the section of the code is as follows:

Code:
red='\[\e[0;31m\]'
RED='\[\e[1;31m\]'
blue='\[\e[0;34m\]'
BLUE='\[\e[1;34m\]'
cyan='\[\e[0;36m\]'
CYAN='\[\e[1;36m\]'
green='\[\e[0;32m\]'
GREEN='\[\e[1;32m\]'
yellow='\[\e[0;33m\]'
YELLOW='\[\e[1;33m\]'
PURPLE='\[\e[1;35m\]'
purple='\[\e[0;35m\]'
nc='\[\e[0m\]'

if [ "$UID" = 0 ]; then
    PS1="$red\[email protected]$red\H$nc:$CYAN\w$nc\\n$red#$nc "
else
    PS1="$PURPLE\[email protected]$CYAN\H$nc:$GREEN\w$nc\\n$GREEN\$$nc "
fi
Here's the funny thing.. I can replace
Code:
"$UID" = 0
with any other user id number and it works. But when it is looking to see if the user is root, it does not... Anyone got any idea why, or better yet a better alternative to look for? I've tried
Code:
$EUID
Code:
id -u
etc.. I haven't been able to figure it out.
 


Swerved

Member
Ding Ding!! Winner winner!

Thanks again, Rob. It totally escaped me that I would have to edit the /root/.bashrc; I was in my normal account so I was editing that one.. Didn't dawn on me that I would need to change the /root one as well since I guess this is kind of a "per user" thing rather than a global setting. Man I wasted a lot of time on this yesterday.. lol

Thanks again,
-Swerved
 
  • Like
Reactions: Rob


Members online



Top