Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My root and admin user both have the same .bashrc file.

The prompt section of the .bashrc is the following:

         if [ "$color_prompt" = yes ]; then
                PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' 
           else
                PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' 
         fi 
         unset color_prompt force_color_prompt

         # If this is an xterm set the title to user@host:dir 
         case "$TERM" in xterm*|rxvt*)
                PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
                ;;
            *)
                ;; 
         esac

But the problem is that the admin user and root user have different prompts.

admin's prompt is:

admin@hostname:~$

and root's prompt is

root@hostname:/home#

So it seems root is using the "xterm" version and admin is not.

Why does the .bashrc file have this difference in prompts? How do I get the admin user to also use the xterm version?

How would I test that condition?

If I run echo $TERM while running as the admin user I get xterm so as far as I can tell, it should be using the xterm version for the admin user.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

It works as expected.

By convention, the prompt ends with $ for users and by # for root. This is the \$ in PS1.

The other difference is the ~ vs /home. This is also normal. It is the \w part of the prompt, the current working path. If it begins with the content of $HOME, it is replaced by ~.

share|improve this answer
    
thank you, settles it. –  Michael Wiles Mar 4 '11 at 9:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.