Re: Yikes! Where is my prompt config hiding?

Re: Yikes! Where is my prompt config hiding?

am 14.04.2008 09:23:12 von googlegroups

On Apr 10, 4:18 pm, Greg Russell wrote:
> On Thu, 10 Apr 2008 12:23:05 -0700, W. D. wrote:
> > Can anyone else help me to automatically show:
> > somehost someuser /somedir#
> > Instead of:
> > bash-3.1#
>
> To apply it to everyone, copy-n-paste the following into /etc/bashrc,
> otherwise into your $HOME/.bashrc and thepromptwill be active next
> shell you open, or into any window to make it immediately active:
>
> export PROMPT_COMMAND='PS1=`if test "$UID" = 0 ; then \
> echo "\[\033[01;31m\]\u@\h $(pwd)]#\[\033[0m\] " ; \
> else \
> echo "\[\033[01;34m\][\u@\h $(pwd)]$\[\033[0m\] " ; \
> fi `'
>
> The 31m is red for root'sprompt; 34m is bluepromptfor everyone not
> root. Feel free to change them to whatever suits your eyes.

Thanks for your help everyone--Especially Greg. These comments
gave me enough hints to find the solution.

As "root" I cd'ed to Root's home directory:

cd ~
pwd
/root

I found out that there wasn't a .bashrc file.

I put this there:

# ======================================================
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# ======================================================

Once I rebooted, I got my needed prompt:

somehost someuser /somedir#

(Of course, I had edited /etc/bashrc previously to produce
this prompt)

Thanks again!