www.smartbusinesschoices.com

Leading Business and Technology,
News and information


Part of the Identityscape.com network...

getxfactor.com jmoodmusic.com smartbusinesschoices.com mintdepot.com lowfaresalways.com evangelicalview.com shoppingpodder.com soproudlywehail.com webnews.ws currenthumor.com

 

 

Emacs as root/color bash prompt
   Smart Linux Business Choices! - the Best of UseNet Postings! Forum Index -> Linux - Slackware Forum  
View previous topic :: View next topic  
Author Message
Robert
Guest






PostPosted: Tue Nov 18, 2008 12:48 am    Post subject: Emacs as root/color bash prompt Reply with quote

Hi,

Slackware 12.1

In /root/.bashrc I have:
PS1='\[\e[1;31m\][\d, \t \W]#\[\e[0m\] '

This is picked up by '$ su' but not '$ su -' which seems to default to
PS1='[\d, \t \W]$ ' from /etc/profile.

'$su ' picks up the .emacs file from my own home directory so running emacs
to edit a file as root makes it unreadable as the color-scheme is gnome2
(green background) with emacs being run in the terminal.

I have a .emacs in /root with a better color scheme for root and this is
picked up by '$su -', but then .bashrc is not.

Is there a way to make '$ su' (or '$su -') pick up both .bashrc and .emacs
from root? Or maybe '# emacs' could open emacs in it's own window (and not
the terminal), then the .emacs of the current user would apply (and at
least be readable).

Bascally what I'm after is the red bash prompt for root from both '$ su'
and '$su -' and emacs to open in it's own window on both (not the
terminal).

regards,
--
Robert
Back to top
Robert
Guest






PostPosted: Tue Nov 18, 2008 1:02 am    Post subject: Re: Emacs as root/color bash prompt Reply with quote

Robert wrote:

[...]
Quote:
Bascally what I'm after is the red bash prompt for root from both '$ su'
and '$su -' and emacs to open in it's own window on both (not the
terminal).

I solved the emacs problem by adding 'xhost local:' to ~/.kde/Autostart, but
I'm still not sure how to get the custom bash prompt for '$ su -'.

regards,
--
Robert
Back to top
notbob
Guest






PostPosted: Tue Nov 18, 2008 1:40 am    Post subject: Re: Emacs as root/color bash prompt Reply with quote

On 2008-11-17, Robert <frostie@fastmail.co.uk> wrote:

Quote:
I'm still not sure how to get the custom bash prompt for '$ su -'.

I put my custom prompt in both my /root/.bash_profile and /root/.bashrc
files (cuz I can never remember which is which). This way, your custom
prompt will come up when you login as root or su or su - from any shell,
wether login or non-login. Don't forget to export:

export PS1='\[\033[1;31m\]\u \w>\[\033[m\]'

The above turns my usual cyan prompt a bright red so I'm reminded I could do
something stupid/dangerous as root. See man bash, the INVOCATION section.

nb
Back to top
Robert
Guest






PostPosted: Tue Nov 18, 2008 2:10 am    Post subject: Re: Emacs as root/color bash prompt Reply with quote

notbob wrote:

[...]

Quote:
I put my custom prompt in both my /root/.bash_profile and /root/.bashrc
files (cuz I can never remember which is which). This way, your custom
prompt will come up when you login as root or su or su - from any shell,
wether login or non-login. Don't forget to export:

..bash_profile did it for su -, thanks nb.

[..]

regards,
--
Robert
Back to top
Display posts from previous:   
   Smart Linux Business Choices! - the Best of UseNet Postings! Forum Index -> Linux - Slackware Forum  
Page 1 of 1
All times are GMT

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum