I can't remember where, but I've already seen the bash prompt's current path shortened in an interesting way: every directory contained in the path (excepted the last one) is replaced by its first letter only. For instance: path/to/some/directory
would be shortened to p/t/s/directory
.
How can I reproduce that behavior ?
Best Answer
After playing with this for a while I got the answer you require:
Add this to your .bashrc file in your home directory, exit the terminal and renter it and you will get you prompt.
It uses the declared function
sps()
to evaluate the path every time the variablePS1
which is the prompt, is displayedie
Or...if you insist on the one letter
Which displays: