You are not logged in.

#1 2008-06-06 17:09:47

Amphaeon
Member
Registered: 2007-01-31
Posts: 72

Color bash for root. No .bashrc [solved]

Im following the Colorize your PS1 and Console entry in the wiki and it says i can colorize my local and root user bash prompts.

It worked fine for my local user. i just edited the .bashrc file as described. but my root dosent have a .bashrc file and when i make one it dosent work.

Last edited by Amphaeon (2008-06-07 01:00:11)

Offline

#2 2008-06-06 17:39:30

sniffles
Member
Registered: 2008-01-23
Posts: 275

Re: Color bash for root. No .bashrc [solved]

How are you logging in as root? What happens when, as root, you run: source ~/.bashrc ?

Offline

#3 2008-06-06 18:10:17

Amphaeon
Member
Registered: 2007-01-31
Posts: 72

Re: Color bash for root. No .bashrc [solved]

im loggin into root by using "su -"

[root@LT-Tech-Mike ~]# source ~/.bashrc
-bash: /root/.bashrc: No such file or directory

Offline

#4 2008-06-06 18:28:16

Misfit138
Misfit Emeritus
From: USA
Registered: 2006-11-27
Posts: 4,189

Re: Color bash for root. No .bashrc [solved]

Are you positive that you created a /root/.bashrc..and created it as root ?
What happens if you cd to /root and then

touch .bashrc

and then

ls -la

?

Offline

#5 2008-06-06 18:37:56

Amphaeon
Member
Registered: 2007-01-31
Posts: 72

Re: Color bash for root. No .bashrc [solved]

i deleted it cause it didnt work. when i had one created it did nothing with the ps1 config.

Offline

#6 2008-06-06 18:54:33

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: Color bash for root. No .bashrc [solved]

I guess if you don't try again, and post all the related stuff (like the contents of /root/.bashrc), there is no way to help you.

Offline

#7 2008-06-06 19:39:21

Amphaeon
Member
Registered: 2007-01-31
Posts: 72

Re: Color bash for root. No .bashrc [solved]

ok so i remade my .bashrc and now i ran source as root on .bashrc and it changes the prompt. but will i have to keep running source .bashrc everytime i su- or login in directly as root in a vty?

my .bashrc contains this:

[root@LT-Tech-Mike ~]# cat .bashrc
alias ls='ls --color=auto'

#Default Color Command Prompt
#PS1='[\u@\h \W]\$ '



#Colorizied Command Prompt
PS1='\[\e[0;31m\]\u\[\e[m\] \[\e[1;34m\]\w\[\e[m\] \[\e[0;31m\]\$ \[\e[m\]\[\e[0;32m\] '

Offline

#8 2008-06-06 20:04:30

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: Color bash for root. No .bashrc [solved]

One thing you can try is to create also /root/.bash_profile with

. $HOME/.bashrc

in it.

Offline

#9 2008-06-06 20:24:25

chris89
Member
From: Austria
Registered: 2008-03-18
Posts: 48

Re: Color bash for root. No .bashrc [solved]

Amphaeon wrote:

ok so i remade my .bashrc and now i ran source as root on .bashrc and it changes the prompt. but will i have to keep running source .bashrc everytime i su- or login in directly as root in a vty?

could be interesting for you, helped me a lot at least: http://www.hypexr.org/bash_tutorial.php

Offline

#10 2008-06-06 20:31:29

Amphaeon
Member
Registered: 2007-01-31
Posts: 72

Re: Color bash for root. No .bashrc [solved]

bender02 wrote:

One thing you can try is to create also /root/.bash_profile with

. $HOME/.bashrc

in it.

you da man. thx

Offline

#11 2008-06-06 23:42:07

Zepp
Member
From: Ontario, Canada
Registered: 2006-03-25
Posts: 334
Website

Re: Color bash for root. No .bashrc [solved]

bender02 wrote:

One thing you can try is to create also /root/.bash_profile with

. $HOME/.bashrc

in it.

Creating a sym link is a better solution.

Offline

#12 2008-06-07 11:36:40

carlocci
Member
From: Padova - Italy
Registered: 2008-02-12
Posts: 368

Re: Color bash for root. No .bashrc [solved]

Zepp wrote:
bender02 wrote:

One thing you can try is to create also /root/.bash_profile with

. $HOME/.bashrc

in it.

Creating a sym link is a better solution.

Why?
This way you can easily edit the login shell runcommands, with a link you would be eliminating the difference between a login shell and a shell

Offline

#13 2008-06-07 16:13:58

Zepp
Member
From: Ontario, Canada
Registered: 2006-03-25
Posts: 334
Website

Re: Color bash for root. No .bashrc [solved]

carlocci wrote:
Zepp wrote:
bender02 wrote:

One thing you can try is to create also /root/.bash_profile with

. $HOME/.bashrc

in it.

Creating a sym link is a better solution.

Why?
This way you can easily edit the login shell runcommands, with a link you would be eliminating the difference between a login shell and a shell

Ya I guess you are right if you want to add some login only stuff latter.  My bad smile.

Offline

Board footer

Powered by FluxBB