Bash PWD Shortening

Posted by dlibby00 on Stack Overflow See other posts from Stack Overflow or by dlibby00
Published on 2009-10-24T01:23:46Z Indexed on 2010/06/01 17:03 UTC
Read the original article Hit count: 201

Filed under:
|

I'm looking for a bash function that will shorten long path names to keep my PS1 variable from getting excessively long. Something along the lines of:

/this/is/the/path/to/a/really/long/directory/i/would/like/shortened

might end up as:

/t../i../t../p../to/a/r../l../d../i/w../like/shortened

something that the took the path and a maximum acceptable number of characters to shorten to would be perfect for my .bashrc file.

© Stack Overflow or respective owner

Related posts about linux

Related posts about bashrc