dimanche 4 janvier 2015

How to trim the CWD, shown in the command promt


To know, what is my CWD in console, I added the following to ~/.bash_profile:



export PS1='$(pwd)$ '


So, pwd result it shown before the $ symbol. It was very nice.


But when I go to a directory with a long name: /var/www/vhosts/beta.sitename.co.uk/httpdocs/sites/beta.sitename.co.uk/modules/bundles


In the command prompt I see:



http://.co.uk/modules/bundles$ sitename.co.uk/httpdocs/sites/beta.sitename.


This makes the shell almost impossible to work with. Is it possible to trim it, keeping only the last part or the dir name? Say, 30 characters.


Or, maybe the better idea would be to print the pwd after every cd command, so I could know, where I am? This can be done using an alias.



Aucun commentaire:

Enregistrer un commentaire