| View previous topic :: View next topic |
| Author |
Message |
Robert Guest
|
Posted: Tue Nov 18, 2008 12:48 am Post subject: Emacs as root/color bash prompt |
|
|
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
|
Posted: Tue Nov 18, 2008 1:02 am Post subject: Re: Emacs as root/color bash prompt |
|
|
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
|
Posted: Tue Nov 18, 2008 1:40 am Post subject: Re: Emacs as root/color bash prompt |
|
|
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
|
Posted: Tue Nov 18, 2008 2:10 am Post subject: Re: Emacs as root/color bash prompt |
|
|
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 |
|