Is it possible to get bash to display the first letter of each directory in my working path?

For example working in:

/home/stuart/src/project/com/example/package
/usr/lib/python2.6

would appear as:

~/s/p/c/e/package$ 
/u/l/python2.6$

Solution 1:

Yes, it is possible and has been done here.

Solution 2:

Try this:

export PS1='$(echo $(dirname \w)|sed -e "s;\(/.\)[^/]*;\1;g")/$(basename \w) $ '