jarik wrote:
Try the line
PS1="\ \h \ \W \ \$ "
Yes, that works. Great!
I'm curious why it's not getting inherited as it is with my setup? Could you mv the new .bashrc and .bash_login out of the way and just do a plain sudo bash, then
<pre>echo $PS1</pre>
\s-\v\$
Also, how is PS1 set in your own .bashrc and .bash_login?
export PS1="\h:\w \u\$ "
Actually, it's not being inherited: instead my own .bashrc gets reread when I sudo bash (bash reads .bashrc from $HOME when starting unless it's a login shell, and $HOME is not being changed by default with sudo). So, I am suspecting that your .bashrc has some control structure to it and the PS1 setting line is not being executed. You could add some debugging to it, maybe a set -x in the beginning.
Hmm. I don't have a .bashrc, I use .bash_profile. I used to use .bashrc, but at some time I changed to .bash_profile, don't remember why, must have been some sort of problem??
So I'll add a .bashrc file to my home. BTW, my entire .bash_profile reads
# additional search paths for executables
PATH=$PATH:/usr/local/sbin:/usr/local/scripts:/usr/X11R6/bin:/sw/bin:/sw/sbin:/D eveloper/Tools
export PATH
# Define prompt
export PS1="\h:\w \u\$ "
$PATH works, so I don't think that $PS1 isn't read. I'd rather say that .bash_profile isn't reread when sudoing? I'll try it out.
Tina
That's odd. I get the correct $PATH when doing sudo bash (as it is set inmy user's .bash_profile), but not the prompt. Still, I don't think that $PS1 is not read correctly when sudoing, since it is correct for my normal user's shell.
Message was edited by: Tina Siegenthaler