I like customizing my PS1 prompt and including the current directory.
I also have several other items such as time, user, git branch and the like, i.e.
However one problem is that when my current directory is many layers 'deep' such as
/home/durrantmm/Dropnot/webs/rails_apps/linker/app/views there is too much text. (btw I carriage return at the end within my PS1 prompt setting anyway so my actual $ is back on the left, that is not the issue here).
So I have a solution for that, to use this for the location part:
LOCATION='\033[01;34m\]`pwd | sed "s#\(/[^/]\+/[^/]\+/[^/]\+/\).*\(/[^/]\+/[^/]\+\)/\?#\1_\2#g"`'
not pretty, but it does the job and I then combine it with the other stuff (not shown, not needed here) and I get "first 3 levels _ last two levels" for the directories, i.e.
Unfortunately though on my mac the sed part isn't working correctly and I get:
[this is actually from my Linux machine, I faked it to show what it looks like on my mac in case you are wondering).
How can I get the
3_2 format for the current directory on my mac ?