Skip to content

Instantly share code, notes, and snippets.

@hkuno9000
Created January 16, 2016 02:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkuno9000/f5468c99507e8cf94162 to your computer and use it in GitHub Desktop.
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.
# 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
}
@hkuno9000
Copy link
Author

another method, using CDPATH

export CDPATH="path1:path2"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment