I have the following in my .bash_profile:PROMPT_DIRTRIM=3export PS1='$ \u in \w: 'However, when I navigate deep within a directory, the path doesn't shorten. This is what the prompt shows:$ myname in ~/Desktop/level3/level4/level5:I've tried restarting iTerm, but it didn't help. When I run bash --version, I get the following output:GNU bash, version 4.3.42(1)-release (x86_64-apple-darwin15.4.0)Copyright (C) 2013 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>This is free software; you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law.Where am I going wrong?EDIT Going even deeper:$ myname in ~/Desktop/level3/level4/level5/level6/level7/level8/level9:
PROMPT_DIRTRIM not working
bash;terminal;prompt;bashrc
If you go a few levels deeper then it'll start truncating$ sweh in ~: cd D1$ sweh in ~/D1: cd D2$ sweh in ~/D1/D2: cd D3$ sweh in ~/D1/D2/D3: cd D4$ sweh in ~/D1/D2/D3/D4: cd D5$ sweh in ~/.../D3/D4/D5: cd D6$ sweh in ~/.../D4/D5/D6: Outside of $HOME it appears to truncates earlier:$ sweh in ~: cd /usr/local/share/locale/$ sweh in .../local/share/locale: You can see it wants to keep 3 levels of directory in both cases, but inside $HOME it prefixes with ~/ and it is smart enough to know that 4 directories vs 3 directories and ... doesn't really matter in that case.The native version of bash that comes with MacOS isn't new enough to understand this.  If you have installed a newer version (eg via brew or from source) then you need to make sure you have changed your user shell via the chsh command so that your running bash window uses the new version of bash and not the old built in one.