Created
January 16, 2016 02:32
-
-
Save hkuno9000/f5468c99507e8cf94162 to your computer and use it in GitHub Desktop.
fuzzy chdir for bash: change folder on a current folder or parent folder.
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
# fuzzy chdir for bash | |
# USAGE: cdx <part-of-folder-names> | |
# HOW TO INSTALL: append "source cdx.sh" to your ".bashrc" | |
cdx() | |
{ | |
for dir in $* $1* ../$1* ../../$1*; do | |
if [ -d "$dir" ]; then | |
pushd "$dir" | |
return | |
fi | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
another method, using CDPATH