Last active
December 31, 2015 06:39
-
-
Save manafire/7949060 to your computer and use it in GitHub Desktop.
Change directory by substituting a string in current working directory with another. Throw this in your aliases file or your rc, or profile file and enjoy.
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
# | |
# CD substitution | |
# usage: cds [target] [substitution] | |
# | |
# if you have a current working directory like this: | |
# ~/code/myproject/en/images/ | |
# and you type: cds en fr | |
# you will change to this directory: | |
# ~/code/myproject/fr/images/ | |
function cds { | |
cd `echo $(pwd) | sed s:/$1/:/$2/:` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment