Created
June 21, 2010 23:37
-
-
Save bobthecow/447701 to your computer and use it in GitHub Desktop.
Change directories really fast
This file contains 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
#!/bin/bash | |
# | |
# Change directories really really fast | |
# | |
# Author: Justin Hileman (http://justinhileman.com) | |
# | |
# Installation: | |
# Add the following function to your `.bashrc` or `.bash_profile`, | |
# or save it somewhere (e.g. `~/.cdd.bash`) and source it in `.bashrc` | |
# | |
# Usage: | |
# `cd .....` is equivalent to `cd ../../../..`, i.e.: | |
# `cd ..` plus one extra dot for each parent directory you want to jump | |
cdd () { | |
cd "$(python -c "d='${1}'; print d if d.strip('.') else '.' + '/..' * (len(d) - 1) if d else '${HOME}'")" | |
} | |
alias 'cd'='cdd' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment