Created
June 4, 2012 17:46
-
-
Save gettalong/2869794 to your computer and use it in GitHub Desktop.
Using Ruby in a Bash function to shorten the CWD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function shorten_pwd { | |
ruby -e "puts Dir.pwd.sub(/^#{ENV['HOME']}/, '~').split('/').map {|l| l.length > 6 ? l[0,3] << '…' << l[-3,3] : l}.join('/')" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment