##What is it ?
Many of us like to see pwd
in bash prompt. However if we travel too deep inside directory trees, the path becomes very lengthy and almost eats all the space. So its good to only show last part of the path. That what this script does.
Before:
After:
##Installation
-
Just put the
gittu-path-prompt.sh
file to some place. Ex: we place it in~/.gittu-path-prompt.sh
-
Now add these line in
.bash_profile
or.profile
or.bashrc
(according to your OS)source ~/.gittu-path-prompt.sh
-
Now add the
\$(__gittu_path)
inside your PS1 and you are done.
##Customizing
- You can edit MAXPATHLEN to set how many chars to show
- You can edit EXTENDSYMBOL to set change the default "..." before chopping the path.
If all these words seems alien to you, just google about "customizing bash prompt"
Happy bash-ing.
Thanks a lot for this awesome work! Masnun helped me finding it :-)