title: Bash PWD Shortening
body: <p>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:</p>
  
  <pre><code>/this/is/the/path/to/a/really/long/directory/i/would/like/shortened
  </code></pre>
  
  <p>might end up as:</p>
  
  <pre><code>/t../i../t../p../to/a/r../l../d../i/w../like/shortened
  </code></pre>
  
  <p>something that the took the path and a maximum acceptable number of characters to shorten to would be perfect for my .bashrc file.</p>