Skip to content

Instantly share code, notes, and snippets.

@rightfold
Created September 28, 2014 10:52
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 rightfold/16b0ca9845b9f0059acc to your computer and use it in GitHub Desktop.
Save rightfold/16b0ca9845b9f0059acc to your computer and use it in GitHub Desktop.
macbook :: ~ % which ..
..: aliased to cd ..
macbook :: ~ % which ...
...: aliased to cd ../..
macbook :: ~ % which cd
cd () {
if [[ "x$*" = "x..." ]]
then
cd ../..
elif [[ "x$*" = "x...." ]]
then
cd ../../..
elif [[ "x$*" = "x....." ]]
then
cd ../../../..
elif [[ "x$*" = "x......" ]]
then
cd ../../../../..
elif [ -d ~/.autoenv ]
then
source ~/.autoenv/activate.sh
autoenv_cd "$@"
else
builtin cd "$@"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment