Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I got myself a .bashrc file off the net. I checked it beforehand, didn't detect anything bad about it.

One thing that's odd about it, is that several spaces are added to the terminal command line.

Screenshot:

alt text Those spaces are not put there by me.

The file can be found here: http://tldp.org/LDP/abs/html/sample-bashrc.html

share|improve this question
    
well, show us your $PROMPT – akira Sep 3 '10 at 7:57
    
@akira: unbound variable – KdgDev Sep 3 '10 at 18:13
up vote 1 down vote accepted

When the prompt contains non-printing characters, they must be surrounded by \[…\]. Otherwise bash counts these characters as part of the width of the prompt.

The prompt settings are missing several instances of \[…\]. Here are the ones I've found after a cursory glance:

function fastprompt()
{
    unset PROMPT_COMMAND
    case $TERM in
        *term | rxvt )
            PS1="\[${HILIT}\][\h]\[$NC\] \W > \[\033]0;\${TERM} [\u@\h] \w\007\]" ;;
        linux )
            PS1="\[${HILIT}\][\h]\[$NC\] \W > " ;;
        *)
            PS1="[\h] \W > " ;;
    esac
}

function powerprompt()
{

    PROMPT_COMMAND=_powerprompt
    case $TERM in
        *term | rxvt  )
            PS1="\[${HILIT}\][\A - \$LOAD]\[$NC\]\n[\u@\h \#] \W > \
                 \[\033]0;\${TERM} [\u@\h] \w\007\]" ;;
        linux )
            PS1="\[${HILIT}\][\A - \$LOAD]\[$NC\]\n[\u@\h \#] \W > " ;;
        * )
            PS1="[\A - \$LOAD]\n[\u@\h \#] \W > " ;;
    esac
}
share|improve this answer

Take a look at the function powerprompt.

If you have copied and pasted it into your .bashrc, you may have gotten spaces at the beginning of the lines ending with \ (backslash).

(Can you post your real .bashrc somewhere instead)? Or try: echo \"$PS1\"

(EDIT: Of course I mean "at the beginning of the lines following the lines ending with \.)

share|improve this answer

Try taking out the code that is in the

#-------------------------------------------------------------
# Shell Prompt
#-------------------------------------------------------------

section of the .bashrc file. This looks to be the area that controls the appearance of the prompt.

What does your prompt look like now? If you don't notice a change, make sure you start a new Terminal window.

Beyond the .bashrc file in your home directory, there are system-wide configurations in the /etc/ folder. They are usually found in /etc/bashrc or /etc/bash_profile (note they are not hidden, no prepended .) depending on the flavour of Linux your are using.

Also - do you have any other .bash_profile or .profile like files in your home directory which might also be acting to configure the prompt?

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .