Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

In some of my projects, I keep a var or a lib folder for runtime output and external libraries. To keep my prompt rather short, I have the export PROMPT_DIRTRIM=3 option in my .bashrc.

This works very well for most paths, but as soon as I have a /var in there, it goes nuts like this (for ~/Projects/someproject/var/gfx):


Interestingly, it works with /opt/lampp/lib

Is there some way to get around this?

share|improve this question
I'm getting ~/.../foo/var/foo. If you have edited your ~/.bashrc, please add its content to the question (you can use – htorque Jun 20 '11 at 18:28
I included the relevant files. – Martin Ueding Jun 20 '11 at 18:58
Are you still looking for help or have you solved this problem? If this question no longer applies then you can either delete it or answer it yourself if you've solved the problem. Thanks! – coversnail Apr 13 '12 at 7:44
Nope, the problem is still there … – Martin Ueding Apr 14 '12 at 10:53
Is the problem still there with a latest version (12.04 or higher) and if so, can you provide more information to your question or anything else you have done in the past months to test or fix the issue. – Luis Alvarado Mar 14 '13 at 15:24

Do you see the same problem if you run PS1='\w\$ '? I suspect it's your scmpromt function that's causing issues, since it appears to output ansi escapes that's not enclosed in \[ and \]. See

share|improve this answer
I encounter the same problem: mu@Martin-iMac:~/...lersllersllersllersllersllers $ becomes just ~/...lersllersllersllersllersllers$. – Martin Ueding Jul 31 '11 at 20:00

Your Answer


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.