Created
August 17, 2013 19:11
-
-
Save magoon/6258317 to your computer and use it in GitHub Desktop.
Bash alias to change dir to a subdirectory containing a known file
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
# | |
# Usage: cdf style.css | |
# | |
# Add to your ~/.bash_profile and then source ~/.bash_profile | |
# | |
# If you were in ~/somedir, this could cd ~/somedir/docroot/styles/ if it contained style.css | |
# | |
alias cdf=cdfilefunc | |
cdfilefunc() | |
{ | |
DIRNAME=`find . -name "$1" -exec dirname {} \;` | |
cd $DIRNAME | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment