• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

Changing Environment

I am trying to change the text color of the command line according to which user is logged in. I have placed the following in both '/etc/profile' and '/etc/bashrc' , but it doesn't work.

if [ $USER = 'root' ] ; then
        COLOUR=41  #red
else
        COLOUR=44  #blue
fi

I am using RH6, what I am missing to make this work?
Thanks
0
jkipp_66
Asked:
jkipp_66
1 Solution
 
poggaCommented:
(I wasnt aware that you could change the colour but anyway ...)
try changing the if statement to use the enviroment variable $LOGNAME instead of USER.
if [ $LOGNAME = 'root' ]; then
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now